[乐意黎原创]访问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)” 

发布了430 篇原创文章 · 获赞 415 · 访问量 925万+
展开阅读全文

RedHat 无法启动apache server

03-08

Apache server无法启动,请大家帮忙看一下是什么原因。谢谢! ``` [root@tcmobtool ssl]# systemctl status httpd.service ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2020-03-07 22:18:35 EST; 1min 58s ago Docs: man:httpd(8) man:apachectl(8) Process: 8406 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE) Process: 8403 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 8403 (code=exited, status=1/FAILURE) Mar 07 22:18:35 tcmobtool systemd[1]: Starting The Apache HTTP Server... Mar 07 22:18:35 tcmobtool systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE Mar 07 22:18:35 tcmobtool kill[8406]: kill: cannot find process "" Mar 07 22:18:35 tcmobtool systemd[1]: httpd.service: control process exited, code=exited status=1 Mar 07 22:18:35 tcmobtool systemd[1]: Failed to start The Apache HTTP Server. Mar 07 22:18:35 tcmobtool systemd[1]: Unit httpd.service entered failed state. Mar 07 22:18:35 tcmobtool systemd[1]: httpd.service failed. [root@tcmobtool ssl]# journalctl -xe Mar 07 22:20:56 tcmobtool sshd[8469]: input_userauth_request: invalid user bugzilla [preauth] Mar 07 22:20:56 tcmobtool sshd[8469]: pam_unix(sshd:auth): check pass; user unknown Mar 07 22:20:56 tcmobtool sshd[8469]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=134.209.194.217 Mar 07 22:20:58 tcmobtool sshd[8469]: Failed password for invalid user bugzilla from 134.209.194.217 port 55304 ssh2 Mar 07 22:20:58 tcmobtool sshd[8469]: Received disconnect from 134.209.194.217 port 55304:11: Bye Bye [preauth] Mar 07 22:20:58 tcmobtool sshd[8469]: Disconnected from 134.209.194.217 port 55304 [preauth] Mar 07 22:21:02 tcmobtool sssd_be[796]: GSSAPI client step 1 Mar 07 22:21:02 tcmobtool sssd_be[796]: GSSAPI client step 1 Mar 07 22:21:02 tcmobtool sssd_be[796]: GSSAPI client step 1 Mar 07 22:21:02 tcmobtool sssd_be[796]: GSSAPI client step 2 Mar 07 22:21:02 tcmobtool unix_chkpwd[8476]: password check failed for user (root) Mar 07 22:21:02 tcmobtool sshd[8472]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=41.221.168.167 user=root Mar 07 22:21:02 tcmobtool sshd[8472]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root" Mar 07 22:21:02 tcmobtool sshd[8471]: reverse mapping checking getaddrinfo for broadband.actcorp.in [106.51.3.214] failed - POSSIBLE BREAK-IN ATTEMPT! Mar 07 22:21:02 tcmobtool unix_chkpwd[8477]: password check failed for user (root) Mar 07 22:21:02 tcmobtool sshd[8471]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=106.51.3.214 user=root Mar 07 22:21:02 tcmobtool sshd[8471]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root" Mar 07 22:21:04 tcmobtool sshd[8472]: Failed password for root from 41.221.168.167 port 33809 ssh2 Mar 07 22:21:04 tcmobtool sshd[8471]: Failed password for root from 106.51.3.214 port 46408 ssh2 Mar 07 22:21:04 tcmobtool sshd[8472]: Received disconnect from 41.221.168.167 port 33809:11: Bye Bye [preauth] Mar 07 22:21:04 tcmobtool sshd[8472]: Disconnected from 41.221.168.167 port 33809 [preauth] Mar 07 22:21:04 tcmobtool sshd[8471]: Received disconnect from 106.51.3.214 port 46408:11: Bye Bye [preauth] Mar 07 22:21:04 tcmobtool sshd[8471]: Disconnected from 106.51.3.214 port 46408 [preauth] lines 1121-1143/1143 (END) ``` 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览