1.下載nginx
下載windows版的Nginx安裝包,進(jìn)入類似下圖頁面顾复,選擇合適版本下載班挖。下載后解壓。
2.下載Windows Service Wrapper工具
選擇合適版本下載芯砸,該工具可設(shè)置nginx為windows服務(wù)萧芙。地址
nginx-service.exe.config內(nèi)容如下:
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
<supportedRuntime version="v4.0" />
</startup>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>
nginx-service.xml內(nèi)容如下:
<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>
3.安裝nginx服務(wù)
進(jìn)入Nginx安裝目錄包帚,然后執(zhí)行命令
nginx-service.exe install