nginx报错nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)

nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)

[日期:2018-11-03]来源:Linux公社  作者:醉落红尘[字体:大 中 小]

 

CentOS 7.5下启动Nginx出现如下错误:

nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)

解决方法:找到你的nginx.conf的文件夹目录,然后运行类似如下命令

nginx -c etc/nginx/nginx.conf

再运行nginx -s reload,就可以了。

如下图:

nginx: [error] open() “/run/nginx.pid” failed (2:

案例2:

如果启动Nginx出现如下错误:

[linuxidc@localhost www.linuxidc.com]$ nginx -s reload
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2018/11/03 10:26:00 [warn] 21354#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:5
2018/11/03 10:26:00 [notice] 21354#0: signal process started
2018/11/03 10:26:00 [alert] 21354#0: kill(21052, 1) failed (1: Operation not permitted)

原因:当前用户对该位置没有写入权限,输入su和密码进入root模式后,重新启动服务器就好了,原因是因为没有权限。

nginx: [error] open() “/run/nginx.pid” failed (2:

注:以非root权限启动时,会出现 nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied) 错误。那就以root权限启动就好。

Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx

本文永久更新链接地址https://www.linuxidc.com/Linux/2018-11/155150.htm 

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值