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. struts2 UI标签 和 主题

    四.Struts2的UI标签和主题 1.Struts2中UI标签的优势 自动的数据回显和错误提示功能 自带的简单样式和排版 2.表单标签的通用属性 说明:UI标签中value的取值一般都是字符串. 2 ...

  2. Contest1593 - 2018-2019赛季多校联合新生训练赛第三场(部分题解)

    H 10255 自然数无序拆分 H 传送门 题干: 题目描述 美羊羊给喜羊羊和沸羊羊出了一道难题,说谁能先做出来,我就奖励给他我自己做的一样礼物.沸羊羊这下可乐了,于是马上答应立刻做出来,喜羊羊见状, ...

  3. 持续集成CI

    一.CI 和 CD 持续集成是什么? 持续集成(Continuous integration,简称CI)指的是,频繁地(一天多次)将代码集成到主干.让产品可以快速迭代,同时还能保持高质量. 持续交付( ...

  4. flask 过滤器

    作用的对象是jinja2模版中的变量({{}}) 参考链接: http://jinja.pocoo.org/docs/2.9/templates/#builtin-filters 内置过滤器 字符串操 ...

  5. 《Apache kafka实战》读书笔记-kafka集群监控工具

    <Apache kafka实战>读书笔记-kafka集群监控工具 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 如官网所述,Kafka使用基于yammer metric ...

  6. Jvm threaddump,heapdump的分析及问题定位

    1 一.Thread Dump介绍 1.1 1.1什么是Thread Dump? 1.2 1.2 Thread Dump特点 1.3 1.3 Thread Dump 能诊断的问题 1.4 1.4如何抓 ...

  7. 网络编程基础【day09】:socketserver进阶(十)

    本节内容 1.概述 2.多用户并发 3.socketserver.BaseServer 一.概述 之前上一篇写的 day8-socketserver使用 讲解了socketsever如何使用,但是在最 ...

  8. Linux记录-salt命令

    salt '*id*'  test.ping salt -N  组名  cmd.run '' salt -G "ipv4:0.0.0.0"  cmd.run '' salt '*i ...

  9. es6 javascript对象方法Object.assign() 对象的合并复制等

    Object.assign方法用于对象的合并,将源对象( source )的所有可枚举属性,复制到目标对象( target ). 详细使用稳步到前辈: http://blog.csdn.net/qq_ ...

  10. vue中element-ui树形控件自定义节点,注意一下

    在项目中用到菜单项编辑删除,在 element-ui自定义节点内容时, 有说明:使用render-content指定渲染函数, 得环境支持 JSX 语法,只要正确地配置了相关依赖,就可以正常运行. 一 ...