This article mainly introduces Nginx’s most basic nginx commands such as starting, stopping, viewing, and testing configuration files on Windows servers.
Nginx command: start nginx
After installing nginx on Windows, we need to start the nginx service. There are two main ways to start the command line operation of the nginx service.
1 |
C:/nginx-1.15.5>nginx.exe |
or
1 |
C:/nginx-1.15.5>start nginx |
Start the nginx command description: Note that because the default port of nginx is also port 80, if you have Apache or IIS service enabled on your server at this time, you must first shut down IIS or Apache service before starting nginx, otherwise the nginx startup command will fail.
Nginx command: stop nginx
There are two main commands to stop nginx on Windows.
1 |
C:/nginx-1.15.5>nginx -s stop |
or
1 |
C:/nginx-1.15.5>nginx -s quit |
The difference between the stop and quit parameters: stop is to stop nginx quickly, may not save the relevant information, quit is a complete and orderly stop nginx, and save relevant information.
The effects of the nginx start and stop commands can be observed through the Processes tab in the Windows Task Manager.
Other nginx command parameters
1 |
nginx -c </path/to/config> |
This command parameter specifies a new nginx configuration file to replace the default nginx configuration file. If you are not sure if the new nginx configuration file syntax is correct, you can test it with the nginx command -t parameter, and the -t parameter means not running the configuration file. Just test the configuration file
1 |
nginx -t -c </path/to/config> |
The difference between nginx command parameters v and V
The nginx -v command simply displays the nginx version information (nginx version), while nginx -V not only displays the nginx version information, but also displays the nginx configuration parameter information.
Reload Nginx
1 |
nginx -s reload |
You can use this command to override nginx when you change the nginx configuration information and need to reload these configurations.
Nginx reopen log file command
1 |
nginx -s reopen |
This article was first published by V on 2018-10-08 and can be reprinted with permission, but please be sure to indicate the original link address of the article :http://www.nginxer.com/records/windows-nginx-command-parameter-usage-details/