Nginx will be installed as a windows service

nginx common operations command

start nginx

tasklist /fi "imagename eq nginx.exe"

nginx -s stop   fast shutdown
nginx -s quit   graceful shutdown
nginx -s reload changing configuration,starting new worker processes with a new configuration,graceful shutdown of old worker processes
nginx -s reopen re-opening log files

nginx installed as a windows service

  • Download Windows Service Wrapper tool, select the appropriate version of the download, this tool can be set to nginx windows service.

  • After downloading the downloaded file winsw-2.1.2-bin.exe on Nginx installation directory (C: \ Program Files \ Nginx), and change the name to nginx-service.exe, then create separate nginx-service.exe.config , nginx-service.xml file, Nginx these two files in the installation directory.

  • nginx-service.exe.config follows:
<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727" />
    <supportedRuntime version="v4.0" />
  </startup>
  <runtime>
    <generatePublisherEvidence enabled="false"/> 
  </runtime>
</configuration>
  • nginx-service.xml as follows (the path is adjusted according to actual situation):
<service>
  <id>nginx</id>
  <name>Nginx Service</name>
  <description>High Performance Nginx Service</description>
  <logpath>C:\Program Files\Nginx\logs</logpath>
  <log mode="roll-by-size">
    <sizeThreshold>10240</sizeThreshold>
    <keepFiles>8</keepFiles>
  </log>
  <executable>C:\Program Files\Nginx\nginx.exe</executable>
  <startarguments>-p C:\Program Files\Nginx</startarguments>
  <stopexecutable>C:\Program Files\Nginx\nginx.exe</stopexecutable>
  <stoparguments>-p C:\Program Files\Nginx -s stop</stoparguments>
</service>

Install nginx nginx-service.exe install Service

Delete nginx service sc delete service name

Windows will be added to the service nginx
windows installed Nginx Service

Guess you like

Origin www.cnblogs.com/ihappycat/p/11823342.html
Recommended