1、下載nginx
nginx: download
http://nginx.org/en/download.html
2、下載
Index of releases/com/sun/winsw/winsw
https://repo.jenkins-ci.org/artifactory/releases/com/sun/winsw/winsw/
把nginx安裝成服務(wù)的工具
1、把winsw-1.18-bin.exe重命名nginx-service.exe
2、創(chuàng)建nginx-service.exe.xml文件富拗,內(nèi)容:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
? ? <startup>
? ? ? ? <supportedRuntime version="v2.0.50727" />
? ? ? ? <supportedRuntime version="v4.0" />
? ? </startup>
? ? <runtime>
? ? ? ? <generatePublisherEvidence enabled="false" />
? ? </runtime>
</configuration>
3、創(chuàng)建nginx-service.xml文件鸣戴,內(nèi)容:
<?xml version="1.0" encoding="UTF-8" ?>
<service>
? ? <id>nginx</id>
? ? <name>nginx</name>
? ? <description>High Performance Nginx Service</description>
? ? <logpath>D:\java_instsll\nginx-1.18.0\logs</logpath>
? ? <log mode="roll-by-size">
? ? ? ? <sizeThreshold>10240</sizeThreshold>
? ? ? ? <keepFiles>8</keepFiles>
? ? </log>
? ? <executable>D:\java_instsll\nginx-1.18.0\nginx.exe</executable>
? ? <startarguments>-p D:\java_instsll\nginx-1.18.0</startarguments>
? ? <stopexecutable>D:\java_instsll\nginx-1.18.0\nginx.exe</stopexecutable>
? ? <stoparguments>-p D:\java_instsll\nginx-1.18.0 -s stop</stoparguments>
</service>
文件中的路徑修改為自己的路徑
4啃沪、以管理員的身份打開(kāi)命令行,切換到nginx路徑窄锅,執(zhí)行nginx-service.exe install
安裝完成
5.卸載服務(wù)
搜索创千,命令提示符,以管理員身份運(yùn)行?
sc delete nginx