How to restart nginx service?

Published on Aug. 22, 2023, 12:20 p.m.

To restart the Nginx service in Linux, you can use the command “systemctl restart nginx” or “service nginx restart” depending on your Linux distribution.

Here’s how you can restart the Nginx service on Ubuntu:

  1. Open a terminal and log in as root or use sudo before the command.
  2. Type “systemctl restart nginx” or “service nginx restart” and press enter.
  3. Wait for the command to complete, and the Nginx service should restart successfully.

Alternatively, you can use the “systemctl stop nginx” command to stop the Nginx service, and then use the “systemctl start nginx” command to start it again.

If for some reason the above commands do not work, you can try to force a full restart of Nginx by using the “killall -9 nginx” command to kill all the Nginx processes and then using a command to start it again, like “systemctl start nginx”.

It’s worth noting that the specific steps to restart the Nginx service may vary depending on your Linux distribution and the version of Nginx you are using. If you encounter any issues, you may want to consult the Nginx documentation or support forums for more specific guidance.

Tags: