在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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章