在window服务器上用wamp搭建完环境后,在PC端或移动手机端输入IP地址,出现Forbidden错误
You don't have permission to access / onthis server.
Apache/2.4.23 (Win64) PHP/5.6.25 Server at 10.10.10.10 Port 80错误。
经过一番百度查询后,找到原因定位到Apache配置文件httpd-vhosts.conf虚拟机配置文件。发现配置文件里有AllowOverride none,Require local。
AllowOverride参数就是指明Apache服务器是否去找.htacess文件作为配置文件,如果设置为none,那么服务器将忽略.htacess文件,如果设置为All,那么所有在.htaccess文件里有的指令都将被重写。
Require local大致意思就是只允许本地服务器访问。
解决方法:
把AllowOverride none 改为AllowOverrideall。
把Require local删掉或用#注释掉
添加Require all granted这条语句,意思是允许所有请求访问资源。