- 下载相应的.exe文件
https://github.com/kohsuke/winsw/releases
- 复制到放在nginx根目录下 重命名为:nginxservice.exe
- 创建一个nginxservice.xml文件, 修改logpath executable stopexecutable 的绝对路径
<service>
<id>nginx</id>
<name>nginx</name>
<description>nginx</description>
<logpath>C:\opt\nginx-1.16.1</logpath>
<logmode>roll</logmode>
<depend></depend>
<executable>C:\opt\nginx-1.16.1\nginx.exe</executable>
<stopexecutable>C:\opt\nginx-1.16.1\nginx.exe -s stop</stopexecutable>
</service>
- 执行执行命令
nginxservice.exe install
- 打开服务 找到nginx 右键启动