Centos7 nginx提示错误 Access denied.?

SELinux will cause this error on CentOS/RHEL 7+ by default :(

CentOS/RHEL 7+ 系统默认会因为SELinux出现这个报错

To test if SELinux is the source of your woes, do

你可以通过下面这个命令关闭SELinux,进行测试

setenforce 0

... and see if everything works. If that fixed it, you can leave SELinux off (weak, you‘re better than that), or you can turn it back on with

看看是否运行正常,如果成功修复了,你可以修改配置文件永久保留关闭,或者再打开SELinux

setenforce 1

... and then properly fix the issue.

然后妥善解决这个问题。

If you do

如果你执行

tail -f /var/log/audit/audit.log

... you‘ll see the SELinux issue. In my case, it was denying PHP-FPM access to web files. You can run the following directives to fix it:

你将会看到是SELinux的问题。在我看来,这是因为SELinux拒绝了PHP-FPM访问Web文件。您可以运行以下指令来修复它:

setsebool -P httpd_can_network_connect_db 1
setsebool -P httpd_can_network_connect 1

This actually didn‘t fix it for me at first, but then restoring SELinux context did it

这一步还没有完全修复好,继续执行下面命令修复上下文

restorecon -R -v /var/www(你的web目录)

Hope that helps.

希望能帮到你

作者:匿名用户

链接:https://www.zhihu.com/question/22128267/answer/105600681

来源:知乎

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

原文地址:https://www.cnblogs.com/zhaijiahui/p/8449371.html

时间: 2024-08-02 12:36:28

Centos7 nginx提示错误 Access denied.?的相关文章

Suse发生了错误Access denied for user ''@'localhost' to&

好久没实用MySQL了,上次由于装了Banq的论坛系统.在用MySQL Administrator进去的时候居然提示mysql error number 1045 access denied for user 'admin'@'localhost' (using password: YES)的错误,看来密码是对了,username错了.最后发现自己居然犯了个第几错误,username应该是root,唉! 同一时候找了别人的资料.一起发上来.供下次使用. Access denied for use

mysql提示:1045 access denied for user'root'@'localhost' using password yes

1.打开DOS进入mysql下bin目录(C:\Program Files\MySQL\MySQL Server 5.6\bin) 2.停止mysql服务,net stop  mysql 3.输入:mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 5.6\my-default.ini" --console --skip-grant-tables 4.重新打开一个DOS窗口,进入mysql下bin目录,输入:mysql

mysql错误 Access denied for user 'root'@'xxx.xxx.xxx.xxx' (using password: YES)

mysql -u root -p Aaa111222333 grant all privileges on *.* to [email protected]'%' identified by 'aaa111222333; Quit lnmp restart ====================================== MySQL登录时出现 Access denied for user 'root'@'xxx.xxx.xxx.xxx' (using password: YES) 的

windows mysql提示:1045 access denied for user'root'@'localhost' using password yes

一大早打开Navicat Lite for MySQL客户端,提示1045 access denied for user ’root’@’localhost’ using password yes,太不给力了,网上搜了很多资料,最终问题得以解决,下面将详细的解决过程分享给大家,希望遇到同样问题的同胞,少走弯路: 1.打开DOS进入mysql下bin目录:本人:C:\Program Files\MySQL\MySQL Server 5.1\bin     2.停止mysql服务,net stop 

phpMyAdmin出现错误 Access denied for user 'root'@'localhost' (using password: NO)

今天安装wmpp,之后启动后点击phpMyAdmin 报拒绝连接错误:#1045 - Access denied for user 'root'@'localhost' (using password: NO) 说是:phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接.您应该检查配置文件中的主机.用户名和密码,并确认这些信息与 MySQL 服务器管理员所给出的信息一致. 经过一番搜索说是没有配置MySQL数据库密码 打开D:\wamp\apps\phpmyadmin x.xx

Mysql 错误 access denied for user ‘root‘ using pa

Centos7 配置Mariadb(mysql)时,客户端登录 1045 access denied for user 'root'@'localhost' using password yes  MariaDB [mysql]> select host,user,password from user; +-----------+------+-------------------------------------------+ | host      | user | password   

C# 删除文件错误 access denied

使用以下代码正常删除整个文件夹内容时,报错如下: if (backupPathDir.Exists) { System.IO.DirectoryInfo di = new DirectoryInfo(backupPathDir.ToString()); foreach (FileInfo file in di.GetFiles()) { file.Attributes = FileAttributes.Normal; file.Delete(); } foreach (DirectoryInfo

解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes

今天想用用MySQL 数据库  谁知道老提示 1045 access denied for user 'root'@'localhost' using password yes 最后在csdn 上找到了答案 来源:http://bbs.csdn.NET/topics/310006640     13楼 解决: 1. 开始 --> cmd   --> net stop mysql  (停用MySQL服务  没启动的可以省略) 2. 找到安装路径 MySQL Server 5.1下的my.ini

关于discuzX3上传头像提示Access denied for agent changed的解决方法

discuzX3.2论坛上传头像时上传10%后,马上红字提示出来access denied for agent changed的问题,为什么头像无法上传出现报错呢? 下面为大家提供“dz论坛上传头像失败,提示access denied for agent changed”的解决办法: 首先检查一下UCenter是否通信正常. 通信问题可以查看: 1.论坛后台 => UCenter 设置=>应用管理:首先查看通信是否成功:不成功则点击编辑. 2.通信密钥与(网站根目录)www.123.com/c