Register now and start sharing your code snippets.
-->
Change nginx configuration on the fly
Shell Script (Bash) posted about 1 year ago by christian
First make your changes to nginx.conf.
Then run the following command to test the new configuration:
1 # nginx -t -c /etc/nginx/nginx.conf 2 2007/10/18 20:55:07 [info] 3125#0: the configuration file /etc/nginx/nginx.conf syntax is ok 3 2007/10/18 20:55:07 [info] 3125#0: the configuration file /etc/nginx/nginx.conf was tested successfully
Next, look for the process id of the master nginx process:
1 # ps -ef|grep nginx 2 root 1911 1 0 18:00 ? 00:00:00 nginx: master process /usr/sbin/nginx 3 www-data 1912 1911 0 18:00 ? 00:00:00 nginx: worker process
Lastly, tell nginx to reload the configuration and restart the worker processes:
1 # kill -HUP 1911