wamp多站点配置

王朝学院·作者佚名  2016-08-27
窄屏简体版  字體: 小  |  中  |  大  |  超大  

网上方法五花白门,特意记录一下,需要的朋友自行拿去就好。

需要修改的文件:httpd.conf / httpd-vhosts.conf / hosts

对应路径:

httpd.conf:wamp\bin\apache\Apache2.2.21\conf

httpd-vhosts.conf:wamp\bin\apache\Apache2.2.21\conf\extra

hosts:c\Windows\System32\drivers\etc

修改流程:

1,打开httpd.conf,约466行:#Include conf/extra/httpd-info.conf,删除#;

2,还是httpd.conf,约188行:

<Directory />

Options FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

</Directory>

改为:

<Directory />

Options FollowSymLinks

AllowOverride None

Order deny,allow

#Deny from all

Allow from all

#允许所有访问

Satisfy all

</Directory>

3,打开httpd-vhosts.conf,在最下方空白处添加以下代码(自行修改wamp安装路径):

<VirtualHost *:80>

ServerAdmin webmaster@dummy-host.example.com

DocumentRoot "f:/wamp/www"

ServerName localhost

ServerAlias www.dummy-host.example.com

ErrorLog "logs/dummy-host.example.com-error.log"

CustomLog "logs/dummy-host.example.com-access.log" common

</VirtualHost>

<VirtualHost *:80>

ServerAdmin webmaster@dummy-host.example.com

DocumentRoot "f:/wamp/www2"

ServerNamewww2.com

ServerAlias www.dummy-host.example.com

ErrorLog "logs/dummy-host.example.com-error.log"

CustomLog "logs/dummy-host.example.com-access.log" common

</VirtualHost>

4,最后一步:打开hosts文件,在最后一行下面添加以下代码:

127.0.0.1 localhost

127.0.0.1 www2.com

重启wamp之后,localhost与www2.com即可区分开发,多站点配置成功。

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航