Windows下Nginx作为服务启动

网友总结如下:

  • 首先下载winsw-1.9-bin.exe小程序
  • 更名为myapp.exe
  • 在nginx安装目录下新建myapp.xml
  • myapp.xml内容如下:
<service>
 <id>nginxid>
 <name>nginxname>
 <description>nginxdescription>
 <executable>D:\nginx-win\nginx.exeexecutable>
 <logpath>D:\nginx-win\logs\logpath>
 <logmode>rolllogmode>
 <depend>depend>
 <startargument>-p D:\nginx-winstartargument>
 <stopargument>-p D:\nginx-win -s stopstopargument>
service>
  • cmd—>myapp.exe install,注意要用admin身份运行

你可能感兴趣的:(Ngnix)