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.
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.
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).
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 .
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With