How to Start, Stop, or Restart Nginx

Nginx (pronounced “engine x”) is a free, open-source, high-performance HTTP and reverse proxy server responsible for handling the load of some of the largest sites on the Internet. It can be used as a standalone web server or as a reverse proxy for Apache and other web servers.
If you are a developer or system administrator, you are likely dealing with Nginx on a regular basis. Starting, stopping, and reloading are the most common tasks when working with an Nginx web server.
This guide explains how to start, stop, and restart Nginx on Linux servers.
Before You Begin
The instructions assume you are logged in as root or as a user with sudo privileges.
Most mainstream Linux distributions use systemd as the default init system and service manager. Both systemd and legacy SysVinit init scripts accept the following arguments to manage the Nginx service:
start— starts the Nginx servicestop— terminates the Nginx servicerestart— stops and then starts the Nginx servicereload— gracefully reloads the configuration; the main process loads the new config and starts new worker processes without dropping active connectionsstatus— shows the current service status
The commands for managing the Nginx service are the same across Linux distributions.
Start, Stop, and Restart Nginx Using systemctl
Use the systemctl command
to control Nginx on systemd-based systems.
To check whether Nginx is currently running:
sudo systemctl status nginxTo start the Nginx service:
sudo systemctl start nginxTo stop the Nginx service:
sudo systemctl stop nginxTo restart the Nginx service (stops and starts it):
sudo systemctl restart nginxReloading vs. Restarting
When adding or editing server blocks, prefer reloading over restarting. A reload loads the new configuration and starts new worker processes without dropping active connections. A restart terminates all connections and starts fresh — use it only when making significant changes such as changing ports or network interfaces.
Before reloading, always test the configuration for syntax errors:
sudo nginx -tIf the test passes, reload the service:
sudo systemctl reload nginxNginx can also be reloaded directly using a signal:
sudo nginx -s reloadAfter restarting or reloading, verify that Nginx is active and responding:
sudo systemctl is-active nginx
curl -I http://localhostEnable or Disable Autostart
To enable Nginx to start automatically on boot:
sudo systemctl enable nginxTo disable autostart:
sudo systemctl disable nginxStart, Stop, and Restart Nginx Using service
Older systems may still use SysVinit init scripts to manage services. Use the service command on those systems.
To restart the Nginx service:
sudo service nginx restartTo reload the Nginx service:
sudo service nginx reloadTo start the Nginx service:
sudo service nginx startTo stop the Nginx service:
sudo service nginx stopTroubleshooting
Nginx fails to start after editing the configuration
A syntax error in the configuration file prevents Nginx from starting. Run sudo nginx -t to identify the error before restarting or reloading. Fix the reported line, then retry.
Port 80 or 443 is already in use
Another process is bound to the port. Check which process is using it with sudo ss -tlnp | grep ':80', then stop that service before starting Nginx.
Permission denied when starting Nginx
Nginx requires elevated privileges to bind to ports below 1024. Make sure you are running the command with sudo, and that no file permission issues exist in the Nginx log or run directories.
systemctl reload fails silently after a config change
Always run sudo nginx -t before reloading. If the configuration contains errors, reload will fail and the old configuration will remain active. Check sudo systemctl status nginx and journalctl
for details.
Quick Reference
For a printable quick reference, see the systemctl cheatsheet .
| Command | Description |
|---|---|
sudo systemctl start nginx | Start Nginx |
sudo systemctl stop nginx | Stop Nginx |
sudo systemctl restart nginx | Stop and start Nginx |
sudo systemctl reload nginx | Reload config without dropping connections |
sudo systemctl status nginx | Show service status |
sudo systemctl enable nginx | Enable autostart on boot |
sudo systemctl disable nginx | Disable autostart on boot |
sudo nginx -t | Test configuration for syntax errors |
sudo nginx -s reload | Reload using signal (alternative to systemctl) |
FAQ
What is the difference between restart and reload?
restart stops the Nginx process and starts it again, dropping all active connections. reload sends a signal to the main process to re-read the configuration and gracefully replace worker processes, keeping active connections alive. Use reload for routine configuration changes.
How do I check if Nginx is running?
Run sudo systemctl status nginx. The output shows whether the service is active, the process ID, and recent log lines. You can also check with curl -I http://localhost.
How do I enable Nginx to start automatically on boot?
Run sudo systemctl enable nginx. To confirm it is enabled, run sudo systemctl is-enabled nginx.
How do I safely reload Nginx after editing a config file?
Always test the configuration first with sudo nginx -t. If the test reports “syntax is ok” and “test is successful”, run sudo systemctl reload nginx to apply the changes without dropping connections.
Conclusion
Use systemctl to start, stop, restart, reload, and manage the autostart behavior of Nginx on systemd-based Linux systems. Always run sudo nginx -t before reloading to catch configuration errors early. For related next steps, you can also review common Nginx operations
and HTTP to HTTPS redirects in Nginx
.
If you have any questions, feel free to leave a comment below.
Tags
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page