These list of Nginx commands should help you better understand and manage Nginx commands based on their functionality.
- Reload Nginx configuration
- Test Nginx configuration for syntax errors
- Start Nginx with a custom configuration file
- Start Nginx with a custom error log file
- Start Nginx with a custom global configuration prefix
- Set a custom worker process count
- Create a temporary backup of the Nginx configuration
- Restore a backup of the Nginx configuration
- Open the main Nginx configuration file with a text editor
- Open a specific server block configuration file with a text editor
- Create a symbolic link to enable a server block
- Remove a symbolic link to disable a server block
sudo nginx
For systemd (Ubuntu 16.04 LTS and above):
sudo systemctl start nginx
Stopping Nginx will kill all system processes quickly. This will terminate Nginx even if there are open connections. In order to do so, run one of the following commands:
sudo nginx -s stop
For systemd (Ubuntu 16.04 LTS and above):
sudo systemctl stop nginx
sudo service nginx restart
For systemd (Ubuntu 16.04 LTS and above):
sudo systemctl restart nginx
sudo nginx -s reload
For systemd (Ubuntu 16.04 LTS and above):
sudo systemctl reload nginx
sudo nginx -s quit
sudo service nginx status
For systemd (Ubuntu 16.04 LTS and above):
sudo systemctl status nginx
sudo nginx -s reload
For systemd (Ubuntu 16.04 LTS and above):
sudo systemctl reload nginx
sudo nginx -t
sudo nginx -c /path/to/custom/nginx.conf
sudo nginx -e /path/to/custom/error.log
sudo nginx -p /path/to/custom/prefix
sudo nginx -g "worker_processes COUNT;"
sudo tail -f /var/log/nginx/error.log
sudo tail -f /var/log/nginx/access.log
sudo nginx -V 2>&1 | grep -o with-http_stub_status_module
sudo cat /run/nginx.pid
sudo kill -s SIGNAL PID
sudo systemctl enable nginx
sudo systemctl disable nginx
nginx -V
nginx -h
sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.backup
sudo cp /etc/nginx/nginx.conf.backup /etc/nginx/nginx.conf
sudo nano /etc/nginx/nginx.conf
sudo nano /etc/nginx/sites-available/your_server_block
sudo ln -s /etc/nginx/sites-available/your_server_block /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/your_server_block
This repository is unlicense[d], so feel free to fork.