Artificial Intelligence Programming Lab(AIPLab) 討論區

科技領域 => 數位匯流 => 主題作者是: admin 於 八月 28, 2017, 12:50:42 am



主題: nginx.exe as Windows system service
作者: admin八月 28, 2017, 12:50:42 am
https://stackoverflow.com/questions/10061191/add-nginx-exe-as-windows-system-service-like-apache (https://stackoverflow.com/questions/10061191/add-nginx-exe-as-windows-system-service-like-apache)
1. Download the latest version of Windows Service Wrapper via github or nuget.
https://github.com/kohsuke/winsw (https://github.com/kohsuke/winsw)

2. Rename winsw-xxxxx.exe to something like nginxservice.exe.
This is the name that will show up for the process that owns your nginx process.

3.Place an XML file next to the exe with the same base name, e.g. nginxservice.xml. The contents should be like below (verify your nginx location).
程式碼: [Select]
<service>
  <id>nginx</id>
  <name>nginx</name>
  <description>nginx</description>
  <executable>c:\nginx\nginx.exe</executable>
  <logpath>c:\nginx\</logpath>
  <logmode>roll</logmode>
  <depend></depend>
  <startargument>-p</startargument>
  <startargument>c:\nginx</startargument>
  <stopexecutable>c:\nginx\nginx.exe</stopexecutable>
  <stopargument>-p</stopargument>
  <stopargument>c:\nginx</stopargument>
  <stopargument>-s</stopargument>
  <stopargument>stop</stopargument>
</service>