阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

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

117次阅读
没有评论

共计 808 个字符,预计需要花费 3 分钟才能阅读完成。

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: No such file or directory)

案例 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: No such file or directory)

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

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计808字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中