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 

... 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 

... 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
setsebool -P httpd_can_network_connect

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

来源:知乎

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

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

  1. 当尝试从ArcCatalog、.net应用或是Java应用中连接ArcGIS Server 时,显示下面任何一种错误提示: "Access Denied" 或 "The connection could not be made"

    Error: 访问拒绝或无法连接错误 文章编号 : 29042 软件: ArcGIS Server 9.0, 9.1, 9.2, 9.3, 9.3.1 操作系统: Windows 2000, XP, ...

  2. jenkins 设置权限后管理员登陆提示:Access Denied admin没有Overall/Read权限

    jenkins 设置权限后,管理员登陆提示:Access Denied  admin没有Overall/Read权限 处理办法: window下编辑 xml 配置文件: %userprofile%\. ...

  3. 错误提示:Access denied for user 'GC'@'localhost' (using password: YES)

    错误描述:使用的是C3P0连接池 Spring整合Mybatis时出现错误 java.sql.SQLException: Access denied for user 'GC'@'localhost' ...

  4. mysql将某数据库的全部权限赋给某用户,提示1044错误Access denied

    mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; ERROR 1044 (4 ...

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

    好久没实用MySQL了,上次由于装了Banq的论坛系统.在用MySQL Administrator进去的时候居然提示mysql error number 1045 access denied for ...

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

    今天安装wmpp,之后启动后点击phpMyAdmin 报拒绝连接错误:#1045 - Access denied for user 'root'@'localhost' (using password ...

  7. Navicat远程连接MySQL 提示1045 - Access denied for user 'root'@'223.74.158.192'(using password:YES)

    问题: 今天在自己的阿里云服务器上(Window Server2012 R2)安装了一个MySQL5.7.26,在阿里云服务器中通过本地链接是正常的,但是当在自己的电脑上使用Navicat连接是提示: ...

  8. eclipse不正常编译导致错误:Access denied for user 'root'@'localhost' (using password: YES)

    使用eclipse连接mysql报错:Access denied for user 'root'@'localhost' (using password: YES) 连接代码没有任何问题,网上找了很多 ...

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

    mysql -u root -p Aaa111222333 grant all privileges on *.* to root@'%' identified by 'aaa111222333; Q ...

随机推荐

  1. poj 2955"Brackets"(区间DP)

    传送门 https://www.cnblogs.com/violet-acmer/p/9852294.html 题意: 给你一个只由 '(' , ')' , '[' , ']' 组成的字符串s[ ], ...

  2. c#委托中的匿名方法和lambda表达式

    一.一般委托方式 Func<int, int, int> AddMethodHander; public unName() { AddMethodHander += AddMethod; ...

  3. WPF开发的界面调用C++生成的dll文件

    以引用d1.dll为例. [生成d1.dll] 文件——新建——项目——Visual C++——Win32项目,选择DLL,点击Finish.在d1.cpp中添加代码 #include "s ...

  4. Luogu P2468 [SDOI2010]粟粟的书架

    一道二合一的题目.两部分思维难度都不太高,但是也都很巧妙.尤其是主席树的\(50\)分,由于本人初学主席树,所以没有见过主席树上二分的套路,就被小小的卡了一下.. \(n <= 200\) \( ...

  5. django_orm查询性能优化

    查询操作和性能优化 1.基本操作 增 models.Tb1.objects.create(c1='xx', c2='oo') 增加一条数据,可以接受字典类型数据 **kwargs obj = mode ...

  6. python对象-多态

    调用不同的子类将会产生不同的行为,而无须明确知道这个子类实际上是什么. 比如,在一个可以播放音频文件的程序中,媒体播放器可能需要加载一个AudioFile对象然后play它,我们把一个play()的方 ...

  7. MySQL最优配置模板( 5.6&5.7)(运维那点事)

    MySQL 5.6&5.7配置文件(姜总提供) [mysql] default-character-set=utf8mb4 user = root password = 123456 port ...

  8. Shell编程(七)函数

    1. 函数开始 #!/bin/bash foo() { echo "Function foo is called"; } echo "-=start=-" fo ...

  9. tomcat自动重新加载应用

    前言 当应用配置文件发生变化时,无需重启tomcat,可以使tomcat重新加载应用. 场景 假设存在一个J2EE应用A,对应war文件名称为A.war,部署在tomcat的webapps目录下,即: ...

  10. tomcat解决GET请求中文参数乱码

    通常,在使用Spring MVC框架的应用程序中,为了解决中文参数乱码的问题,都会添加如下过滤器配置: <filter> <filter-name>encodingFilter ...