问题:今天配制一个测试机服务器 Apache2.4.9本地访问正常但是在局域网或外网IP拒绝访问
局域网浏览器报错如下图:
查看Apache报错日志如下信息:
[Fri May 13 15:10:08.565138 2016] [authz_core:error] [pid 4964:tid 836] [client 192.168.0.200:53640] AH01630: client denied by server configuration: F:/wamp/www/test/
[Fri May 13 15:10:09.749206 2016] [authz_core:error] [pid 4964:tid 836] [client 192.168.0.200:53640] AH01630: client denied by server configuration: F:/wamp/www/test/
解决如下:
1、关闭防火墙(注:包括杀毒软件,防火墙),当然你也可以写规则开放你服务器的端口
a、一般如果你的Apache是2.2版本以下的配制如下虚拟主机就可以解决此问题
<VirtualHost *:80>
<Directory "F:/wamp/www/test">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerAdmin [email protected]
DocumentRoot "F:/wamp/www/test"
ServerName www.test.com
DirectoryIndex index.php index.html
ServerAlias test.com
ErrorLog "logs/test.bin-error_log"
CustomLog "logs/test.bin-access_log" common
</VirtualHost>
b、如果你的Apache服务器是2.4.0以上的版本你还需要做第2步
2、 在虚拟主机配制文件中添加 Require all granted
<VirtualHost *:80>
<Directory "F:/wamp/www/test">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
ServerAdmin [email protected]
DocumentRoot "F:/wamp/www/test"
ServerName www.test.com
DirectoryIndex index.php index.html
ServerAlias test.com
ErrorLog "logs/test.bin-error_log"
CustomLog "logs/test.bin-access_log" common
</VirtualHost>
3、重启你自己的Apache服务器生效