用户名:  密码:   
您当前的位置:首页 > 

WAMPServer2.5开启网络访问

上次修改时间: 2019-03-10 12:53:05      来源:网络总结      作者:钢铁长陈
上一页      路径:DSD\WAMP相关\      下一页

WAMPServer2.5开启网络访问

WAMPServer2.5默认只能在安装机器通过http://localhost访问
解决方法:
1.编辑C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf文件开启虚拟机功能
#Include conf/extra/httpd-vhosts.conf //找到这句前面的注释符号#,

2.编辑C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf文件
将httpd-vhosts.conf文件第一段如下   
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error.log"
    CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
修改为:
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "C:\wamp\www"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error.log"
    CustomLog "logs/dummy-host.example.com-access.log" common
    <Directory "C:\wamp\www">
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Require all granted
    </Directory>
</VirtualHost>
说明:主要是加入如下代码,WAMPServer2.5以前版本Require all granted这句可能为Allow from all
    <Directory "C:\wamp\www">
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Require all granted
    </Directory>
  
注:修改后DocumentRoot和Directory后面的路径要改为网站目录的实际路径
注2: 在虚拟机测试不成功的原因是没有关闭虚拟机防火墙, 也ping不能虚拟机
错误1: 本地用IP能访问,远程访问时提示: You don't have permission to access / on this server. 原因是httpd-vhosts.conf中没加下面这段
    <Directory "C:\wamp\www">
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Require all granted
    </Directory>