一聚教程网:一个值得你收藏的教程网站

热门教程

WAMP虚拟目录的设置方法

时间:2022-06-30 17:55:54 编辑:袖梨 来源:一聚教程网


1.打开Apache的配置文件httpd.conf,并去掉#Include conf/extra/httpd-vhosts.conf前面的#!!

2.打开Apache的apache/conf/extra下的次配置文件httpd-vhosts.conf

3.将此文件下的原有的扩展配置文件(如下):删除一个或两个,或者全注释掉


ServerAdmin webmaster@dummy-host2.localhost
DocumentRoot /www/docs/dummy-host2.localhost
ServerName dummy-host2.localhost
ErrorLog logs/dummy-host2.localhost-error_log
CustomLog logs/dummy-host2.localhost-access_log common

4.在httpd-vhosts.conf文件的末尾添加上:


DocumentRoot D:/wamp/website/a.com
ServerName www.a.com

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all


5.打开在C:/WINDOWS/system32/drivers/etc中的hosts文件中加上如下的内容

127.0.0.1    www.111com.net

6.这样我们就配置好了名为wamp的虚拟主机,重启一下我们在浏览器中输入wamp就可以查看到D:/wamp/www目录下的内容了!!

7.但是这样localhost访问则出现了问题,这时需要我们,同样将localhost设为虚拟主机


DocumentRoot D:/wamp/www
ServerName localhost

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

8.为了让其他电脑用IP访问电脑,需要在httpd.conf 中搜索127.0.0.1,修改为all

热门栏目