windows 下安装nginx 这里就不说了直奔猪蹄
1、下载winsw工具:
http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/1.18/winsw-1.18-bin.exe
下载该工具后,将其放在 Nginx安装目录下,并重命名为nginx-service.exe
2、创建配置文件nginx-service.xml(名字要和工具名一样),创建nginx-service.exe.config(为支持NET 4.0 runtime,默认只支持NET 2.0 runtime)
nginx-service.xml内容如下:
<service>
<id>nginx</id>
<name>Nginx Service</name>
<description>Nginx Service</description>
<logpath>E:\Program Files (x86)\nginx-1.15.12\logs</logpath>
<log mode="roll-by-size">
<sizeThreshold>10240</sizeThreshold>
<keepFiles>8</keepFiles>
</log>
<executable>E:\Program Files (x86)\nginx-1.15.12\nginx.exe</executable>
<startarguments>-p E:\Program Files (x86)\nginx-1.15.12</startarguments>
<stopexecutable>E:\Program Files (x86)\nginx-1.15.12\nginx.exe</stopexecutable>
<stoparguments>-p E:\Program Files (x86)\nginx-1.15.12 -s stop</stoparguments>
</service>
nginx-service.exe.config 内容如下:
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
<supportedRuntime version="v4.0" />
</startup>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>
3、在命令行输入nginx-service.exe install
4、出现以下情况说明设置成功