微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

[乐意黎原创]访问Centos下Apache主机页面抛You don't have permission to access / on this server.

Forbidden

You don't have permission to access / on this server.
Server unable to read htaccess file,denying access to be safe


查看apache 日志,是这样显示的:

[Fri Jun 22 10:29:25.114474 2018] [core:crit] [pid 5027:tid 140011563378432] (13)Permission denied: [client 123.126.113.133:24873] AH00529: /usr/local/apache/.htaccess pcfg_openfile: unable to check htaccess file,ensure it is readable and that '/usr/local/apache/' is executable


d是目录文件

-rw------- (600) 只有所有者才有读和写的权限
-rw-r--r-- (644) 只有所有者才有读和写的权限,组群和其他人只有读的权限

-rwx------ (700) 只有所有者才有读,写,执行的权限
-rwxr-xr-x (755) 只有所有者才有读,写,执行的权限,组群和其他人只有读和执行的权限
-rwx--x--x (711) 只有所有者才有读,写,执行的权限,组群和其他人只有执行的权限
-rw-rw-rw- (666) 每个人都有读写的权限
-rwxrwxrwx (777) 每个人都有读写和执行的权限


为 aerchi.com 目录增加权限
chown -R daemon /usr/local/apache/websites/aerchi.com && chmod 755 -R /usr/local/apache/websites/aerchi.com

解决PHP Warning: file_get_contents Failed to open stream: no suitable wrapper Could be found.

路径: /etc/PHP.ini

此警告说服务器阻止访问远程文件,修改PHP.ini

allow_url_fopen = Off
allow_url_include = Off
改成
allow_url_fopen = On
allow_url_include = On

重启PHP-fpm或者重启web服务.


错误:

Failed to open stream: HTTP request Failed! HTTP/1.1 400 Bad Request\r\n in /usr/local/apache/websites/xxx.PHP on line 4864,

可以解决某些人的问题,有人说在PHP.ini中,有这样两个选项:allow_url_fopen =on(表示可以通过url打开远程文件),user_agent="PHP"(表示通过哪种脚本访问网络,认前面有个 " ; " 去掉即可。)重启服务器。

但是有些还是会有这个警告信息,想用完美的解决还差一步,还得设置PHP.ini里面的user_agent,PHP认的user_agent是PHP,我们把它改成Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)来模拟浏览器就可以了

user_agent=”Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)”

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native
centos6.5下postgres-XC集群安装与配置
CentOS 6使用openssl搭建根CA
CentOS6.6中安装VNC server
CentOS下更新Python最新版本