Skip to content

How to Restart Nginx

Daniel Neto edited this page Feb 25, 2023 · 1 revision

Common issues

When you update an SSL certificate with Certbot, the new certificate is stored in a location that is accessible to both Apache and Nginx. However, after updating the certificate, Apache is reloaded by default to use the new certificate while Nginx is not reloaded. As a result, Nginx may continue to use the old certificate, or it may not be able to start at all due to a conflict between the old and new certificates.

This can lead to several issues, including:

  • The website may display an SSL warning to users, indicating that the certificate is not trusted or has expired.
  • The website may not load at all, as the SSL handshake may fail due to an incorrect or outdated certificate.
  • The website may be vulnerable to attacks, as an outdated or incorrect SSL certificate can compromise the security of the website and its users.

To prevent these issues, it is essential to ensure that Nginx is also reloaded after updating an SSL certificate with Certbot, to make sure that it is using the latest certificate.

Fix this issue

Open an SSH terminal to your server, once you're logged in to the server, type the following command to stop Nginx:

sudo /usr/local/nginx/sbin/nginx -s stop

This command sends a signal to the Nginx process to shut down gracefully.

To start Nginx again, enter the following command:

sudo /usr/local/nginx/sbin/nginx

This command starts the Nginx process.

That's it! You've successfully restarted Nginx using an SSH terminal.

Clone this wiki locally