下载WinSW
下载64位即可
WinSW-x64.exe复制到nginx目录下修改为nginxservice.exe
在 nginxservice.exe 同目录中,新建一个空的 nginxservice.xml 文件(名字要与nginxservice.exe 名字前缀保持一致,但后缀是xml) ,
nginxservice.xml 的内容:
<service>
<id>nginx</id>
<name>nginx</name>
<description>nginx</description>
<logpath>D:\nginx-1.25.4\logs</logpath>
<logmode>roll</logmode>
<depend></depend>
<executable>D:\nginx-1.25.4\nginx.exe</executable>
<stopexecutable>D:\nginx-1.25.4\nginx.exe -s stop</stopexecutable>
</service>
执行nginxservice.exe install
说明安装成功,如果有错误请看日志