Nginx install Windows Service

(A) download install nginx

Go to the official website to download windows nginx stable version
Download: http: //nginx.org/en/download.html
Here Insert Picture Descriptiondownload, unzip the file, for example, D: \ under ibms \ nginx-1.15.3 directory

(B) download the Windows Service Wrapper

Then we need the help of "Windows Service Wrapper" gadget,
Project address: https://github.com/kohsuke/winsw
Download: http: //repo.jenkins-ci.org/releases/com/sun/winsw/winsw /
Here Insert Picture Descriptionafter you download the tool, place Nginx installation directory and rename it to nginx-service.exe,
create a profile nginx-service.xml (name and name of the tool to the same)
then create nginx-service.exe.config , file directory as shown below

Here Insert Picture Description

(3) The modification nginx-service.xml

<?xml version="1.0" encoding="UTF-8"?>
<service>
  <id>nginx</id>
  <name>Nginx Service</name>
  <description>High Performance Nginx Service</description>
  <logpath>D:\ibms\nginx-1.15.3\logs</logpath>
  <log mode="roll-by-size">
    <sizeThreshold>10240</sizeThreshold>
    <keepFiles>8</keepFiles>
  </log>
  <executable>D:\ibms\nginx-1.15.3\nginx.exe</executable>
  <startarguments>-p D:\ibms\nginx-1.15.3</startarguments>
  <stopexecutable>D:\ibms\nginx-1.15.3\nginx.exe</stopexecutable>
  <stoparguments>-p D:\ibms\nginx-1.15.3 -s stop</stoparguments>
</service>

(Iv) modified nginx-service.exe.config

<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727" />
    <supportedRuntime version="v4.0" />
  </startup>
  <runtime>
    <generatePublisherEvidence enabled="false"/> 
  </runtime>
</configuration>

(E) has been run cmd administrator

Entering nginx root, and then enter the command nginx-service.exe install, below
Here Insert Picture Description
and see-Service nginx service in the service list installation is complete
Here Insert Picture Description

Published 75 original articles · won praise 44 · views 510 000 +

Guess you like

Origin blog.csdn.net/u013254183/article/details/103472450
Recommended