windows install nginx and create it as a service

Install nginx

Download http://nginx.org/en/download.html and unzip to XXX directory

Set Nginx as a Windows service

Complete with winsw tool

1. Download Windows Service Wrapper

Official website address:

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

download link:

http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/

2. Rename "winsw-xxx-bin.exe" to "nginx-service.exe" and copy it to the nginx root directory

Create the nginx-service.xml file in the nginx root directory, with the following content:

<service>

 <id>nginx</id>

 <name>nginx</name>

 <description>nginx</description>

 <logpath>E:\nginx-1.14.1\</logpath>

 <logmode>roll</logmode>

 <depend></depend>

  <executable>E:\nginx-1.14.1\nginx.exe</executable>

  <stopexecutable>E:\nginx-1.14.1\nginx.exe -s stop</stopexecutable>

</service>

 

Run nginx-service.exe install in cmd window

Then you can start the service in the Windows service panel

Guess you like

Origin blog.csdn.net/zzchances/article/details/107731090