1.保证httpd.conf下
Include conf/extra/httpd-vhosts.conf
LoadModule php5_module "D:/E/php/wamp/bin/php/php5.5.12/php5apache2_4.dll"
PHPIniDir D:/E/php/wamp/bin/php/php5.5.12
没被注释掉
2.打开多站点配置:
Listen 0.0.0.0:80
Listen [::0]:80
4.http-vhosts.conf配置(注意 Require all granted,不要写成什么allow from all什么的。可以参考httpd.conf中的写法。)
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "D:/E/php/wamp/think"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
<Directory "D:/E/php/wamp/think">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "D:/E/php/wamp/test"
ServerName www.test.com
ServerAlias localhost
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
<Directory "D:/E/php/wamp/think">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
最后在hosts文件中配置IP和域名。