When you've made some changes to your Nginx configuration, you would likely reload the Nginx service or restart the Nginx service.
In your Debian or Ubuntu terminal type in the following command to stop the Nginx service:
sudo systemctl stop nginx
This will stop the Nginx service and you can now make any necessary changes to the configuration files.
When you're ready to start the service again, type in the following command:
sudo systemctl start nginx
The Nginx service should be up and running again.
But what if you just want to restart the service instead of stopping and starting it separately? Well, there's this specific command just for you! Just type in the following:
sudo systemctl restart nginx
And that's it! You've successfully restarted the Nginx service in Ubuntu.
If you encounter any issues while restarting the Nginx service, don't panic. You can always check the Nginx logs for errors. They are usually located in the
Restarting the Nginx service in Debian or Ubuntu is a simple process that can be done in just a few commands.
For more explanation, you can visit Nginx Official Docs - Stopping or Restarting Nginx. Of course, these commands are applicable to all Debian distros.