Windows Nginx start stop and other basic operation commands

  • 2020-05-15 03:36:57
  • OfStack

To use Nginx under Windows, we need to master some basic operation commands, such as: start, stop Nginx service, reload Nginx, etc. I will give a brief introduction below.

1. Startup:


C:\server\nginx-1.0.2>start nginx

or


C:\server\nginx-1.0.2>nginx.exe

Note: it is recommended to use type 1. Type 2 will keep your cmd window 1 in execution and not allow other command operations.

2. Stop:


C:\server\nginx-1.0.2>nginx.exe -s stop

or


C:\server\nginx-1.0.2>nginx.exe -s quit

Note: stop is quick stop nginx, may not save the relevant information; quit is a complete and orderly stop nginx and save the relevant information.

3. Reload Nginx:


C:\server\nginx-1.0.2>nginx.exe -s reload

Use this command when configuration information is modified and these configurations need to be reloaded.

4. Re-open the log file:


C:\server\nginx-1.0.2>nginx.exe -s reopen

5. View Nginx version:


C:\server\nginx-1.0.2>nginx -v

nginx: nginx version: nginx/1.0.2

or


C:\server\nginx-1.0.2>nginx -V

nginx: nginx version: nginx/1.0.2 
nginx: TLS SNI support enabled 
nginx: configure arguments: --builddir=objs.msvc8 --crossbuild=win32 --with-debug --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs.msvc8/lib/pcre-7.9 --with-zlib=objs.msvc8/lib/zlib-1.2.3 --with-select_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-mail --with-ipv6 --with-openssl=objs.msvc8/lib/openssl-0.9.8r --with-openssl-opt=enable-tlsext --with-http_ssl_module --with-mail_ssl_module

Note: v simply displays version information, while V not only displays version information, but also displays configuration parameter information.

6. Test or load the specified configuration file:

Test profile


C:\server\nginx-1.0.2>nginx.exe -t -c conf/default.conf

nginx: the configuration file C:\server\nginx-1.0.2/conf/default.conf syntax isok
nginx: configuration file C:\server\nginx-1.0.2/conf/default.conf test is successful

Loads the specified configuration file


C:\server\nginx-1.0.2>start nginx.exe -c conf/default.conf

The commands described in this article are very basic, and there's plenty of room to remember that you can just try a few more times


Related articles: