Nginx open() “/etc/nginx/nginx.conf” failed (13: Permission denied)

Though I’ve set the full path to 777, this issue doesn’t gone.

Refer to SO

When you are getting permission denied errors on file access etc. for unknown reason, it might be related to SELinux. Especially when you see a period following permissions like drwxr-xr-x. shown byls -l for the file/dir in question, they could be mislabeled (you can see it by ls -Z) and cause the problem.

You should first check current SELinux mode by running getenforce. If it says Enforcing, then temporarily set the mode to Permissive by running setenforce 0, and see if your application works afterwards.

Please consult your distribution’s guide on SELinux for permanent fix, including setting the SELinux mode on start up, relabeling files or directories, updating policies, etc. Here’s Howto for CentOS.

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 这个错误提示是由于权限问题导致的。错误信息中指出了"/etc/nginx/nginx.conf"文件的打开失败,原因是权限被拒绝。\[1\]通常,这是因为nginx进程没有足够的权限来读取或写入该文件。解决这个问题的方法是确保nginx进程具有足够的权限来访问该文件。你可以尝试使用chmod命令更改文件的权限,例如"chmod 644 /etc/nginx/nginx.conf"。另外,还要确保nginx进程的运行用户具有访问该文件的权限。你可以通过检查nginx配置文件中的"user"指令来确定nginx进程使用的用户。如果需要,你可以修改该指令以使用具有适当权限的用户。 #### 引用[.reference_title] - *1* *3* [nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)错误解决](https://blog.csdn.net/qq_27508477/article/details/88539756)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Nginx报错:nginx: [emerg] open() “/usr/local/nginx/../conf/nginx.conffailed (2: No such file or ...](https://blog.csdn.net/Dontla/article/details/120964159)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值