Open nginx official website
http://nginx.org/en/download.html
Select a stable version Stable version and download it to your hard disk, the folder is named in English, such as nginx-1.14.0
After downloading, extract it to the folder, there is nginx.exe in it
Add the path path to the system environment variable
Open https://github.com/kohsuke/winsw/releases
Some people are constantly updating WINSW, we need to download one of these to register the service
I downloaded the winsw-v2.1.2 version WinSW.NET4.exe this
After downloading, put it in the nginx-1.14.0 folder
Change the name to nginxservice.exe
Create a text document and paste the following
Take my nginx folder path as an example, my file is under D:WNMP/Nginx-1.14.0, so the path below is modified by myself. There are three places to modify
<service>
<id>nginx</id>
<name>nginx</name>
<description>nginx</description>
<logpath>D:WNMP/Nginx-1.14.0\</logpath>
<logmode>roll</logmode>
<depend></depend>
<executable>D:WNMP/Nginx-1.14.0\nginx.exe</executable>
<stopexecutable>D:WNMP/Nginx-1.14.0\nginx.exe -s stop</stopexecutable>
</service>
Paste it, after modification, rename the file name and extension to xml, which should correspond to nginxservice.exe, nginxservice.xml
This can be installed
Open cmd with administrator privileges
To install nginxservice.exe install
After installation, enter the service view and start it.