在windows下用winsw把nginx当成服务运行

1. 下载winsw 

https://github.com/kohsuke/winsw/releases


2. 配置winsw.xml,把winsw放在nginx同一目录

<configuration>
  <id>nginx</id>
  <name>nginx</name>
  <description>nginx</description>
  <executable>%BASE%/nginx.exe</executable>
  <stopexecutable>%BASE%/nginx.exe -s stop</stopexecutable>
  <logpath>%BASE%/logs/</logpath>
  <logmode>roll</logmode>
  <depend></depend>
</configuration>
3.安装,以管理员身份启动cmd

  winsw install

  winsw uninstall //卸载

4.启动、关闭服务

  net start nginx

  net stop nginx

猜你喜欢

转载自blog.csdn.net/free_wind22/article/details/80505065