After you make configuration changes to your web server or other service, you generally have to restart the process to get it to recognize the updated settings. The problem is that the regular restart first kills the process and all of the worker processes, and then starts it all up again — which will (briefly) make your website go offline.
The solution is to use the graceful restart feature to get the web server process to read in the new configuration changes without taking the server down. Luckily nginx, Apache, PHP-FPM, and many other services support this.
What actually happens is that nginx starts a new process with a new set of worker processes that accept requests, and the old worker processes are instructed to gracefully shut down. So any new visitors that come to your site won’t have to wait for the whole thing to restart.
Restart nginx Gracefully
There are multiple ways to do this, depending on what operating system you are using, but the one method that works on every platform is to just pass the reload signal to the nginx process directly. The -s argument to nginx is for passing a “signal” and that signal is “reload”.
nginx -s reload
This will only work if the nginx sbin directory is in your path, so realistically you’ll need to use the full path like this:
/usr/local/nginx/sbin/nginx -s reload
It’s worth noting that you should probably test the nginx configuration before you pass the reload command — you can do that with “nginx -t”.
You can also reload using the service command on distributions that support it (like Ubuntu or Debian). So the command would be this:
service nginx reload
- › Keychron Q8 Mechanical Keyboard Review: An Advanced Keyboard for All Uses
- › Shift+Enter Is a Secret Shortcut Everyone Should Know
- › 10 Hidden Android 13 Features You Might Have Missed
- › Lenovo ThinkPad Z13 Gen 1 Review: A Vegan Leather Laptop That Means Business
- › 7 Features Android Should Steal From iPhone
- › 10 Awesome iPad Features You Should Be Using