nginx.pid No such file or diretory
来源:2-14 Nginx虚拟主机单网卡多IP配置演示

CatCian
2020-01-14
请问下如何解决/var/run/nginx.pid centos7目录下没有,导致无法重启nginx?
[react@localhost run]$ nginx -s stop -c /etc/nginx/nginx.conf
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2020/01/14 14:53:26 [warn] 11955#11955: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:2
2020/01/14 14:53:26 [notice] 11955#11955: signal process started
2020/01/14 14:53:26 [error] 11955#11955: open() "/var/run/nginx.pid" failed (2: No such file or directory)
[react@localhost run]$ sudo nginx -s stop -c /etc/nginx/nginx.conf
[sudo] react 的密码:
nginx: [error] open() "/var/run/nginx.pid" failed (2: No such file or directory)
nginx 版本
[react@localhost run]$ nginx -v
nginx version: nginx/1.16.1
centos 版本
[react@localhost run]$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.7.1908 (Core)
Release: 7.7.1908
Codename: Core
写回答
1回答
-
Jeson
2020-01-15
1、首先需要看下为什么会有这种问题,是因为/var/run 这个目录不存在吗?还是错误删除了。
2、这个时候只能手动新建立一个,把pid写入进去、并设置好对应的文件权限再关闭试试。
或者通过kill pid的方式关闭nginx.
00
相似问题