下载winSW:https://github.com/kohsuke/winsw/releases
重命名为:server.exe
创建server.xml:
<service>
<id>nginx</id>
<name>Nginx Service</name>
<description>High Performance Nginx Service</description>
<logpath>E:\soft\nginx1.16\logs</logpath>
<log mode="roll-by-size">
<sizeThreshold>10240</sizeThreshold>
<keepFiles>8</keepFiles>
</log>
<executable>E:\soft\nginx1.16\nginx.exe</executable>
<startarguments>-p E:\soft\nginx1.16</startarguments>
<stopexecutable>E:\soft\nginx1.16\nginx.exe</stopexecutable>
<stoparguments>-p E:\soft\nginx1.16 -s stop</stoparguments>
</service>
创建server.conf:
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
<supportedRuntime version="v4.0" />
</startup>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>
cmd下运行:
server.exe install
浏览器输入:localhost 验证