I want Nginx to update configuration file without reloading or restarting Nginx. It seem API or anything (http://nginx.com/products/on-the-fly-reconfiguration/).
You need to reload or restart Nginx whenever you make changes to its configuration. The reload command loads the new configuration, starts new worker processes with the new configuration, and gracefully shuts down old worker processes.
nginx -t will test the syntax of the configuration files and ensure that all configuration files referenced are accessible. If the Nginx configuration passes testing, then Nginx will be reloaded with nginx -s reload .
Restart vs Reload Nginx If Nginx notices a syntax error in any of the configuration files, the reload is aborted and the server keeps running based on old config files. Reloading is safer than restarting Nginx. The restart command will shut down the server including all related services and power it on again.
On Ubuntu or Debian it's as simple as using the reload
argument:
service nginx reload
The official way is to send SIGHUP:
kill -HUP $(ps -ef | grep nginx | grep master | awk '{print $2}')
The above command will get the process ID of the nginx master process and send a SIGHUP signal to it.
See the Controlling Nginx documentation for Nginx.
You can also use the Nginx binary:
nginx -s reload
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