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. jquery+ajax无刷新加载数据,新闻浏览更多

      <script type="text/javascript"> $(document).ready(function (){ $(window).scroll(fu ...

  2. 2018.12.14 浪在ACM 集训队第九次测试赛

    浪在ACM 集训队第九次测试赛 B Battleship E Masha and two friends B 传送门 题意: 战船上有占地n*n的房间cells[][],只由当cells[i][j]= ...

  3. bigdata learning unit one--Hadoop environment setting

    1.配置ssh,使集群服务器之间的通讯,不再每次都输入密码进行认证. 2. [root@hc--uatbeta2 hadoop]# start-all.shStarting namenodes on ...

  4. springcloud实战案例苏宁和海信

    http://springcloud.cn/view/341 为什么springlcoud不选用zookeeper: http://www.infoq.com/cn/articles/why-does ...

  5. python自动化开发-[第十八天]-django的ORM补充与ajax,分页器

    今日概要: 1.ORM一对多,多对多 2.正向查询,反向查询 3.聚合查询与分组查询 4.F查询和Q查询 5.ajax 6.分页器 一.ORM补充: django在终端打印sql语句设置: LOGGI ...

  6. Java基础构造方法和this关键字整理

    构造方法 8.1构造方法介绍 构造方法的格式: 修饰符 构造方法名(参数列表) { } l  构造方法的体现: n  构造方法没有返回值类型.也不需要写返回值.因为它是为构建对象的,对象创建完,方法就 ...

  7. JavaSE_坚持读源码_String对象_Java1.7

    /** * Compares this string to the specified object. The result is {@code * true} if and only if the ...

  8. MyBatis-Select 流程

    mybatis 版本:3.5.1 测试代码: public interface MyUserMapperAnnotation { @Select("select * from myuser ...

  9. JAVA核心技术I---JAVA基础知识(文件系统及java文件基本操作)

    一:文件概述 文件系统是由OS(操作系统)管理的 文件系统和Java进程是平行的,是两套系统 文件系统是由文件夹和文件递归组合而成 文件目录分隔符 –Linux/Unix 用/隔开 –Windows用 ...

  10. 鼠标右键Table的td弹出多级菜单,双击td编辑

    <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="C ...