Start Nginx (using the default configuration file)

nginx
Copy the code

or

service start nginx
Copy the code

Start Nginx (custom profile)

Nginx -c [custom path /nginx.conf]Copy the code

Nginx configuration file path and check whether there is an error:

nginx -t
Copy the code

Hot loading, reloading the configuration file. After modifying nginx.conf, you need to run this command for it to take effect

nginx -s reload
Copy the code

View the Nginx process

Ps - ef | grep nginxCopy the code

Close the Nginx process

Force an immediate shutdown. This is not recommended

nginx -s stop

A normal shutdown processes incoming requests but does not accept new ones

nginx -s quit

Reload the configuration file

nginx -s reload

Re-open the log file

nginx -s reopen

Check whether the configuration file is incorrect

nginx -t

If the configuration file is incorrect, the system prints the configuration file

nginx -T

View the nginx version

nginx -v

View nginx versions and build configurations

nginx -V

sudo systemctl enable nginx

sudo systemctl start nginx

sudo systemctl restart nginx

sudo systemctl stop nginx

sudo systemctl status nginx