nginx: [error] invalid PID number ““ in “/usr/local/nginx/logs/nginx.pid“

background:

When running after editing nginx.conf , nginx is already running, and then appears when entering ./nginx -s reload

nginx: [error] invalid PID number “” in “/usr/local/nginx/logs/nginx.pid” 

Enter the corresponding directory and you can see that nginx.pid is empty, so it cannot end or restart nginx .

reason:

        The reason is that each nginx process corresponds to an id, which is stored in nginx.pid, and when recompiling, the id number in nginx.pid may be stuck due to some bugs, so it cannot be restarted. To solve this problem, you can kill all nginx processes, and then use the -c command to specify the configuration file to start .

Solution:

Case 1: Restart nginx with the -c command by specifying the nginx.conf file


cd /usr/local/nginx/sbin/      #进入/usr/local/nginx/sbin/目录

killall -9 nginx              # 杀掉所有nginx进程

./nginx -t                #检查配置文件是否有错

./nginx -c /usr/local/nginx/conf/nginx.conf     # 指定配置文件-c启动nginx

Case 2: nginx.pid in nginx.conf is commented out

        Enter the conf configuration file directory under the usr/local/nginx/ installation directory , edit the nginx.conf configuration file, and cancel the comment on the pid save process line.

cd /usr/local/nginx/conf        #进入nginx的conf配置文件夹目录
vi nginx..conf                #编辑配置文件

cd /usr/local/nginx/sbin       #进入nginx启动命令文件夹
./nginx -s reload             #重新启动nginx

The above methods can solve the problem that the nginx process number is invalid! ! !

-----------------------------------------No text below--------- ---------------------------------------------

Note: For study only, record questions and reference, encourage each other!

Reference documents:

1. Solve nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"_cxs123678's Blog-CSDN Blog

2、 

Solve nginx: [error] invalid PID number ““ in “/usr/local/nginx/logs/nginx.pid“_wardenzsy's blog-CSDN blog

3. nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)_Liu Chu, Ge Nian's Blog-CSDN Blog

Supongo que te gusta

Origin blog.csdn.net/qq_39715000/article/details/125052859
Recomendado
Clasificación