Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two questions:

  • Is there a difference between: nginx -s reload and pkill -HUP -F nginx.pid
  • What is the proper way to watch the Nginx conf file and upon changes test the conf file (nginx -t), and if it passes reload Nginx. Can that be done with runit or a process manager like Supervisor?
share|improve this question
    
What specific GNU/Linux distro is this? –  dawud May 29 '13 at 19:27

1 Answer 1

up vote 0 down vote accepted

nginx -s reload also sends a HUP signal as per the man pages.

Refer to Nginx Man Pages

For the second part. It is possible monitor the nginx.conf file for changes and trigger a test and reload on change. I use a bash script and run it every 15 seconds using supervise. Monitor the mtime of the config file and upon change run nginx -t which will return exit code 0 upon successful verification of config file, then reload.

share|improve this answer
    
If it is GNU/Linux, you can use inotify or on FreeBSd you can use kqueue/kevent to monitor a file (windows has IO completion ports). The mtime approach can be faked via setattr to reset the mtime but should suffice for simple needs and it is based on polling. –  hackworks Jun 3 '13 at 3:14
    
is this better than using /etc/init.d/nginx reload ? –  DanFromGermany Jan 19 at 19:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.