用Windows Service Wrapper工具实现windows下实现nginx开机自启。
- 下载工具地址我已经打包 下载地址 用的是winsw-1.19-bin.exe 解压至nginx安装目录service
- 修改路径
<service>
<id>NginxService</id>
<name>NginxService</name>
<description>NginxService</description>
<executable>C:\YaleSoftFiles\Develop\nginx-1.11.3\nginx.exe</executable>
<logpath>C:\YaleSoftFiles\Develop\nginx-1.11.3\service\log</logpath>
<logmode>roll</logmode>
<depend></depend>
<startargument>-p</startargument>
<startargument>C:\YaleSoftFiles\Develop\nginx-1.11.3</startargument>
<stopexecutable>C:\YaleSoftFiles\Develop\nginx-1.11.3\nginx.exe</stopexecutable>
<stopargument>-p</stopargument>
<stopargument>C:\YaleSoftFiles\Develop\nginx-1.11.3</stopargument>
<stopargument>-s</stopargument>
<stopargument>stop</stopargument>
</service>
-
进入windows-->system32-->右键“以管理员的方式打开”cmd.exe
-
进入service目录执行installService.bat
-
命令行:services.msc
- 卸载服务:
sc delete NginxService
参考:http://www.cnblogs.com/xusion/articles/3035327.html