514   Apache

想在本地电脑弄个域名测试,于是在wamp配置virtualhost

1,本地电脑win7配置域名,直接修改C:\Windows\System32\drivers\etc目录下的hosts文件,需要管理员权限,添加内容:

127.0.0.1 localhost.test4

127.0.0.1 localhost.test5

 

2,接着在wamp的apache的目录,配置目录conf,修改内容,引用virtualhost的配置文件httpd-vhosts.conf

Include conf/extra/httpd-vhosts.conf

 

3,修改httpd-vhosts.conf,添加以下内容:DocumentRoot根据自己目录修改,ServerName也是

<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "D:/wamp/www/test5"
ServerName localhost.test4
#ServerAlias www.dummy-host.example.com
ErrorLog "logs/localhost.test4-error.log"
CustomLog "logs/localhost.test4-access.log" common
</VirtualHost>

<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "D:/wamp/www/test5"
ServerName localhost.test5
#ServerAlias www.dummy-host.example.com
ErrorLog "logs/localhost.test5-error.log"
CustomLog "logs/localhost.test5-access.log" common
</VirtualHost>

 

4,重启wamp即可

 

 




Leave a Reply

Your email address will not be published. Required fields are marked *