Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Start, Stop, or Restart Nginx - DesignLinux

Oct 18 2020
designlinux 0 Comments
How to Start, Stop, or Restart Nginx

Nginx is a free, high performance and open-source HTTP and reverse proxy server. It can be used as a standalone web server, and as a reverse proxy for Apache and other web servers. In this guide, we will show you how to start, stop and restart Nginx on Linux.

For a system administrator or a developer, starting, stopping, and restarting are the most common tasks when working with an Nginx webserver.

Prerequisites#

You should logged in as root or user account with sudo privileges.

Currently, most of Linux distributions are using SystemD as the default init system and service manager. Below are the arguments to manage the Nginx service:

  • start: It will start the Nginx service.
  • stop: Used to terminate the Nginx service.
  • restart: To stop and then start the Nginx service again.
  • reload: Gracefully restarts the Nginx service. On reload, the main Nginx process shuts down the child processes, loads the new configuration, and starts new child processes.
  • status: Shows the service status.

For all the Linux distributions, commands for managing the Nginx service are the same.

Start, Stop and Restart Nginx using systemctl#

All the latest linux distributions like, Ubuntu 20.04 / 18.04, Debian 10 / 9, CentOS 8, 7 releases have the SystemD as a default system and service manager.

It’s required to restart or reload the nginx service whenever you made any changes to Nginx configuration. To restart the Nginx service use the following command:

sudo systemctl restart nginx

It recommended that you reload Nginx service when you add or edit server blocks. On reload the Nginx loads the new configuration and starts the processes with the new configuration. While the restart only making significant changes like changing ports or interfaces.

To reload the Nginx service run the below command:

sudo systemctl restart nginx

You can directly controlled the Nginx using signals. For instance, to reload the service you can use the following command:

sudo /usr/sbin/nginx -s reload

Start the Nginx service by running the following command:

sudo systemctl start nginx

Execute the following command to stop the Nginx service:

sudo systemctl stop nginx

Conclusion#

You have learned how to start, stop, and restart the Nginx web server on Linux systems.

If you have any questions or feedback, feel free to comment below.

Related

Tags: nginx, terminal

Install Lubuntu 20.04 – A Lightweight Linux Desktop Environment

Prev Post

Get and Change the Current Working Directory in Python

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 71
  • 1,054,843

DesignLinux.com © All rights reserved

Go to mobile version