下载地址:
把下载的文件(winsw.exe)复制到nginx目录(D:\nginx-1.12.2)
nginx目录下创建一个同名的Windows Service Wrapper的XML配置文件(winsw-1.9-bin.xml)
文件内容如下:
<service>
<id>nginx</id>
<name>Nginx Service</name>
<description>High Performance Nginx Service</description>
<logpath>D:\nginx-1.12.2\logs</logpath>
<log mode="roll-by-size">
<sizeThreshold>10240</sizeThreshold>
<keepFiles>8</keepFiles>
</log>
<executable>D:\nginx-1.12.2\nginx.exe</executable>
<startarguments>-p D:\nginx-1.12.2</startarguments>
<stopexecutable>D:\nginx-1.12.2\nginx.exe</stopexecutable>
<stoparguments>-p D:\nginx-1.12.2\ -s stop</stoparguments>
</service>
说明:
Nginx Service #这是服务里面名字
High Performance Nginx Service #这里是对服务的描述 4、命令行执行安装命令
Windows Servcie Wrapper的命令格式如下:
CMD:> winsw-1.9-bin.exe install
CMD:> winsw-1.9-bin.exe uninstall
CMD:> winsw-1.9-bin.exe start
CMD:> winsw-1.9-bin.exe stop