How to Start, Stop, Restart, and Reload Nginx on Ubuntu Linux

Ubuntu Linux background with penguin

This article explains starting, stopping, restarting, and reloading Nginx services and processes on Ubuntu Linux.

If you are new to Ubuntu Linux and managing a Nginx web server, below are some resources to get you started.

Also, when learning to use and manage a Linux server, Ubuntu Linux might be where you want to start. Not to say other Linux distributions are not good or easy to manage, but Ubuntu Linux is the easiest to manage.

When you run a Nginx web server, you will also want to learn how to manage it. Below, we’ll list some of our favorite posts on managing Nginx on Ubuntu Linux.

This post only focuses on stopping, restarting, and reloading Nginx services.

Stop, Start, Restart, and Reload Nginx services

As mentioned above, you should know the basics of managing a Nginx web server. The related posts and steps below will go a long way in helping you get to your goals.

Start Nginx services on Ubuntu Linux

On Ubuntu Linux, you can start Nginx services and processes using the command below.

sudo systemctl start nginx

Alternatively, the command below can also start Nginx services and processes.

sudo /etc/init.d/nginx start

Stop Nginx services on Ubuntu Linux

On Ubuntu Linux, you can stop Nginx services using the command below.

sudo systemctl stop nginx

Yet, the command below can also stop Nginx services and processes.

sudo /etc/init.d/nginx stop

Restart Nginx services on Ubuntu Linux

If some cases, you may not want to stop entirely or shut down Nginx services, then start them up again. In that case, you can use the restart option to restart Nginx services.

Example.

sudo systemctl restart nginx
or
sudo /etc/init.d/nginx restart

Reload Nginx services on Ubuntu Linux

You can reload Nginx services to gracefully apply new configuration changes without stopping the web server. It gently restarts Nginx without killing its entire process. Only child processes are stopped and restarted.

You can only use the reload command if Nginx is already running.

Below is how to use the reload command.

sudo systemctl reload nginx

You can execute these operations with the Nginx web server to start, stop, restart, and reload its services.

  • start: Starts the process.
  • stop: Stops the process.
  • restart: It will stop the process and start it again.
  • reload: This performs a graceful restart. This stops the child processes only, loads the new config, and starts the child processes.

That’s it!

Related Nginx posts:

Conclusion:

This post showed you how to start, stop, restart, and reload Nginx processes in Ubuntu Linux. If you find any errors above or have something to add, please use the comments form below.

Posted by
Richard

I love computers; maybe way too much. What I learned I try to share at geekrewind.com.

Leave a Reply

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

%d bloggers like this: