Nginx is installed under windows
Download address http://nginx.org/en/download.html win and linux versions are downloaded here.
The win version is very convenient to use, pure green, and can be decompressed. To start, you need to CD to the nginx installation directory under the command line, and execute the following command:
Start the service: nginx.exe:start nginx.exe
Stop service: nginx-s stop
Reload configuration: nginx-s reload
However, this requires manual startup. If some operations need to restart the server, especially when multiple users are operating the server, it is inevitable to forget to start nginx. Therefore, you still need to add it to the windows service to make it more convenient to automatically:
Go to https://github.com/kohsuke/winsw to download: windows service wrapper, use this tool to add nginx to the windows service:
After downloading, copy it to the nginx root directory, rename it to the name you need, such as nginx-service.exe, and create a new xml file, which is the same as the name you renamed, such as nginx-service.xml. The content format is as follows:
NginxNginx ServiceHigh Performance Nginx Service (you can write in Chinese here) D:/nginx-1.13.5/nginx.exeD:/nginx-1.13.5/roll-pD:/nginx-1.13.5-pD:/nginx-1.13.5-s stop
Cd to the nginx installation directory under cmd, execute: nginx-service.exe install (uninstall the service using the uninstall parameter)
If the command is executed successfully, there will be an extra nginx service in the windows installation directory, such as:
When windows server 2012 executes, you will be prompted to install .net framework 3.5. use "Server Manager"-"Dashboard"-"add roles and Features"-(four "next steps") "Features"-check ".NET Framework 3.5 features" to install (installation requires restarting the server)