wamp修改多站点配置

本文介绍如果在wamp中修改配置支持多站点。

第1步,修改httpd.conf,增加8080端口的监听



#Listen 12.34.56.78:80
Listen 80
Listen 8080

第2步,修改virtual hosts的配置,同样在httpd.conf这个文件中。

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
#修改为
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

第3步,增加虚拟主机配置,修改httpd-vhosts.conf文件。

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
NameVirtualHost *:8080

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/wamp/www/"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
<Directory "C:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:8080>
ServerAdmin [email protected]
DocumentRoot "C:/wamp/www2/"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
<Directory "C:/wamp/www2/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

第4步,重启apache,就可以看到效果了

----------------------------------------------------------------------------------------------


删掉httpd-vhosts.conf文件中的这段代码导致的:

<VirtualHost *:80>
   ServerAdmin [email protected]
   DocumentRoot "c:/Apache23/docs/dummy-host.example.com"
   ServerName dummy-host.example.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>


删掉或者注释掉这段代码,再运行localhost就没有问题了。


6、localhost运行好使了,但运行localhost:8080却有新的问题:


Forbidden


You don't have permission to access /index.phpon this server.


7、然后也是找了很多,多是说什么allow from all等等的问题。但无论我怎么设置都是这个问题。

几经波折,发现把Options Indexes FollowSymLinks 后面添加上 ExecCGI就好使了。

<VirtualHost *:8080>
   DocumentRoot D:/wamp/www/aa
   ServerName localhost
   <Directory "d:/wamp/www/aa">
       Options Indexes FollowSymLinks ExecCGI
       Order allow,deny
       Allow from all
       AllowOverride All
   </Directory>
</VirtualHost>


你可能感兴趣的:(wamp修改多站点配置)