Learn how to Start, Stop, or Restart Nginx server

how to Start Stop or Restart Nginx server

In this article, we are going to show you that how to to Start, Stop, or Restart Nginx server. if you want learn how to to Start, Stop, or Restart Nginx server then this post is ideal for you.

NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.

Prerequisites

  • System with Nginx installed and configured
  • Access to a terminal window or command line
  • A user account with sudo or root privileges

Below are listed the main arguments to manage the Nginx server service:

  • start: To start the Nginx server service.
  • stop: It is used to stop/terminate the Nginx server service.
  • restart: It is used to stop and then start the Nginx server service again.
  • reload: To Trestarts the Nginx service. On the reload, main Nginx server process shuts down the child processes, loads the new configuration, and starts new child processes.
  • status: It is shows the Nginx server service status.

Start, Stop and Restart Nginx using systemctl

For all the latest versions of Ubuntu, CentOS, and Debian are using SystemD as a default system and service manager to start, stop and restart the Nginx services.


To restart the Nginx service :

You need to restart or reload the webserver processes when you made any changes to the Nginx configuration, run the below command to restart the Nginx service:

sudo systemctl restart nginx

To reload the Nginx service :

sudo systemctl reload nginx

You can also manage the Nginx services using signals. For a example, you can reload the Nginx service using the below command:

sudo /usr/sbin/nginx -s reload

To start the Nginx service :

sudo systemctl start nginx

To stop the Nginx service :

sudo systemctl stop nginx

Start, Stop and Restart Nginx using SysVinit

For older versions of Ubuntu, CentOS, and Debian are using init.d scripts to start, stop and restart the Nginx services.

Restart the Nginx service:

sudo service nginx restart

To Start the Nginx service:

sudo service nginx start

Stop the Nginx service:

sudo service nginx stop

That’s all

If you face any error and issue in above steps , please use comment box below to report

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top