1、打开 bin\apache\apache2.2.8\httpd.conf 中去掉
Include conf/extra/httpd-vhosts.conf
前的#号
2、打开 conf/extra/httpd-vhosts.conf 中添加
NameVirtualHost *:80
之后根据项目依照下面的格式来修改
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "D:/wamp/www/test" ServerName test ErrorLog "logs/dummy-host.example.com-error.log" CustomLog "logs/dummy-host.example.com-access.log" common <Directory "D:/wamp/www/test"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory></VirtualHost>
3、打开 C:\WINDOWS\system32\drivers\etc\hosts 文件添加
127.0.0.1 test
注意:这是的网站名与httpd-vhost中的ServerName一直
4、最后重启apache,打开浏览器,输入http://test即可
时间: 2024-12-16 09:37:15