原文:
https://www.cnblogs.com/lujiulong/p/9025066.html
一、下载Windows Service Wrapper
下载地址:http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/1.18/winsw-1.18-bin.exe
二、放在nginx目录下,并修改名字为nginx-service.exe
三、创建配置文件nginx-service.exe.config
和nginx-service.xml
1、nginx-service.xml
<service>
<id>nginx</id>
<name>Nginx Service</name>
<description>High Performance Nginx Service</description>
<logpath>C:
ginx-1.14.0logs</logpath>
<log mode="roll-by-size">
<sizeThreshold>10240</sizeThreshold>
<keepFiles>8</keepFiles>
</log>
<executable>C:
ginx-1.14.0
ginx.exe</executable>
<startarguments>-p C:
ginx-1.14.0</startarguments>
<stopexecutable>C:
ginx-1.14.0
ginx.exe</stopexecutable>
<stoparguments>-p C:
ginx-1.14.0 -s stop</stoparguments>
</service>
2、nginx-service.exe.config
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
<supportedRuntime version="v4.0" />
</startup>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>
四、在cmd中执行命令
nginx-service.exe install