Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I lost nginx.pid,it disappeared

Tags:

nginx

Here is part of my nginx.conf:

pid        /www/nginx0836/nginx.pid;

While I restart nginx, in several seconds I run ls /www/nginx0836 and it lists nginx.pid. But after several seconds, running ls /www/nginx0836 again, nginx.pid is not listed. Why? By the way, nginx server works well and when I run

ps -ef | grep "nginx: master process" | grep -v "grep" | awk -F ' ' '{print $2}'

then I can see nginx pid.

like image 645
smarthand Avatar asked Oct 11 '10 07:10

smarthand


People also ask

Where can I find nginx PID file?

The process ID of the master process is written, by default, to the nginx. pid file, which is located in the /usr/local/nginx/logs or /var/run directory.

What is nginx PID file?

The PID file stores the main process ID of the nginx process. This file should be protected from unauthorized modification. Rationale: The PID file should be owned by root and the group root. It should also be readable to everyone, but only writable by root (permissions 644).

Where is nginx setup?

NGINX Configuration: Understanding Directives. Every NGINX configuration file will be found in the /etc/nginx/ directory, with the main configuration file located in /etc/nginx/nginx. conf .

Why does nginx fail?

Basically, you get the error “service nginx restart fails” when something goes wrong while you edit the nginx. conf. Nginx doesn't restart after that. This command will help you to find any error in config file.


1 Answers

try monitoring folder with incrond and log any changes with $# $@ on that directory. may be you will see something like puppet or an rsync deleting the pid file.

/www/nginx0836 IN_DELETE echo "$# $@"

it will log any delete event on directory

simpler than audit...

sorry the poor english

like image 97
BrenoZan Avatar answered Sep 27 '22 02:09

BrenoZan