在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

相关文章

Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...
Windows文件操作基础代码 Windows下对文件进行操作使用的一段...
Winpcap基础代码 使用Winpcap进行网络数据的截获和发送都需要...
使用vbs脚本进行批量编码转换 最近需要使用SourceInsight查看...