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

前端之家收集整理的这篇文章主要介绍了[乐意黎原创]访问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)”

原文链接:https://www.f2er.com/centos/374188.html

猜你在找的CentOS相关文章