Nginx Tutorial
Most important commands of Nginx
Here are the commands to Start, Stop, Reload, and Kill Nginx with the Nginx Command:
sudo systemctl start nginx
This command starts the Nginx service.
sudo systemctl stop nginx
This command stops the Nginx service.
sudo systemctl reload nginx
This command reloads the Nginx configuration files without interrupting active connections.
sudo killall nginx
This command immediately terminates the Nginx process.
sudo systemctl status nginx
The command “sudo systemctl status nginx” displays the current status of the Nginx service, including whether it is running, inactive, or failed, and other relevant information such as process ID, uptime, and recent log entries.
sudo service nginx quit
The command “service nginx quit” stops the Nginx service.
nginx -t
The command “nginx -t” tests the configuration files for Nginx and returns whether the configuration is valid or not.
sudo service nginx -v
The command “service nginx -v” displays the version of the Nginx service.
sudo service nginx -h
The command “service nginx -h” or “service nginx -?” displays the help or usage information for the Nginx service.
sudo service nginx -?
The command “service nginx -?” displays the help or usage information for the Nginx service.
Note: The commands provided assume a system using Systemd as the init system. If you are using a different init system, the commands to Start, Stop, Reload, and Kill Nginx may be different.