Home > php教程 > php手册 > body text

[1]PHP开发环境搭配之Apache2.2配置

WBOY
Release: 2016-06-06 20:02:04
Original
1142 people have browsed it

Step1. 软件准备:httpd-2.2.25-win32-x86-no_ssl.msi 下载地址:http://download.csdn.net/detail/uudmail0818/6983753 Step2. 在D盘建立AMP文件夹,用于安装LAMP需要的软件 双击httpd-2.2.25-win32-x86-no_ssl.msi开始安装 这里选择自定义的custom 更改安

Step1.

软件准备:httpd-2.2.25-win32-x86-no_ssl.msi

下载地址:http://download.csdn.net/detail/uudmail0818/6983753


Step2.

在D盘建立AMP文件夹,用于安装LAMP需要的软件

双击httpd-2.2.25-win32-x86-no_ssl.msi开始安装

[1]PHP开发环境搭配之Apache2.2配置

这里选择自定义的custom

[1]PHP开发环境搭配之Apache2.2配置

更改安装路径

[1]PHP开发环境搭配之Apache2.2配置

一路到finish


Step3.

启动Apache 

[1]PHP开发环境搭配之Apache2.2配置

测试下

在浏览器中输入localhost,回车显示it works。说明配置成功


配置虚拟目录步骤

主要配置

找到DocumentRoot和Directory

把后面的目录改成你想储存网站源码的位置

如我的是存在D盘的www目录下的。

DocumentRoot "D:/www"

另外改个地方,在DocumentRoot和Directory之间的deny from all删掉

加上Allow from all


    Options FollowSymLinks
    AllowOverride None
    Order deny,allow    
    Allow from all


把#Include conf/extra/httpd-vhosts.conf 前面的#去掉

表示开启虚拟目录扩展


可选项配置

在httpd.conf主配置文件,

DirectoryIndex 设置,代表默认主页

可以设置index.html ,index.php default.html等等,

也可以设置多个默认主页,且优先级按顺序从前到后降低.


在extra文件夹下找到httpd-vhosts文件,打开编辑

复制一份以下代码


    ServerAdmin webmaster@dummy-host2.localhost
    DocumentRoot "D:/Amp/apache2.2/docs/dummy-host2.localhost"
    ServerName dummy-host2.localhost
    ErrorLog "logs/dummy-host2.localhost-error.log"
    CustomLog "logs/dummy-host2.localhost-access.log" common

修改成以下格式,主要是配置DocumentRoot 和ServerName,其他的可以暂时不了解。


 
    DocumentRoot "D:\Amp\apache2.2\htdocs"
    ServerName localhost  


这个设置的域名为www.myphp.com。可以本地直接访问
 
    DocumentRoot "D:/www/myphp"
    ServerName www.myphp.com   


这个设置的域名为www.phpweb.com。可以本地直接访问
 
    DocumentRoot "D:/www/phpweb"
    ServerName www.phpweb.com   

最后在系统的hosts文件中加入

127.0.0.1 www.myphp.com
127.0.0.1 www.phpweb.com

即可成功。




source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!