一、wamp 配置虚拟域名,自定义域名
1、d:wampinapacheApache2.2.17confhttpd.conf
(1)#Include conf/extra/httpd-vhosts.conf 去掉注释
(2)找到这段
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
改为
<Directory />
Options FollowSymLinks Includes
AllowOverride None
Order deny,allow
Allow from all
</Directory>
2、d:wampinapacheApache2.2.17confextrahttpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "d:wampwww文件夹"
ServerName 域名1(不用http)
ServerAlias 域名2 (不用http)
</VirtualHost>
3、C:WINDOWSsystem32driversetchosts
底部添加记录: 127.0.0.1 你要设置的域名2(不用http)
只要文件夹下有文件,就可以通过设置的域名在浏览器访问。
二、wamp 127.0.0.1正常打开,localhost空白403/404
(1) d:wampinapacheApache2.2.17confextrahttpd-vhosts.conf添加记录
<VirtualHost *:80>
DocumentRoot "d:wampwww"
ServerName localhost
</VirtualHost>
(2)d:wampinapacheApache2.2.17confhttpd.conf
找到
Deny from all
Allow from 127.0.0.1
改为
#Deny from all
#Allow from 127.0.0.1
Allow from all
若还有问题,就查看一下 C:WINDOWSsystem32driversetchosts 里面是否有该记录,没有自己添加: 127.0.0.1 localhost
同理,若想localhostphpmyadmin正常访问:
D:wampaliasphpmyadmin.conf
找到
Deny from all
Allow from 127.0.0.1
改为
#Deny from all
#Allow from 127.0.0.1
Allow from all