If Nginx needs to be manually started every time, it is very troublesome, so it is best to set it as Windows System service, boot from boot on the line.
1. Download and modify the operating environment Support program
1),: http://ng-srvinst.attron.org/
2), modify the contents of the Ng_srv.xml file:
[HTML]View Plaincopyprint?
- <service>
- <ID>nginx</ID>
- <name>nginx</name>
- <description>nginx</description>
- <executable>d:\www\nginx\nginx.exe</executable>
- <logpath>d:\www\logs\</logpath>
- <logmode>roll</logmode>
- <depend></depend>
- <startargument>-p d:\www\nginx</startargument>
- <stopargument>-p d:\www\nginx-s stop</stopargument>
- </Service>
<service> <id>nginx</id> <name>nginx</name> <description> nginx</description> <executable>d:\www\nginx\nginx.exe</executable> <logpath >d:\www\logs\</logpath> <logmode>roll</logmode> <depend></depend> <startargument>-p d:\www\nginx</startargument> <stopargument>-p d:\www\nginx-s Stop </stopargument>
Change the Nginx directory of the above file to the directory where your native nginx resides. My nginx version is 1.6.0 and the modified file is as follows:
[HTML]View Plaincopyprint?
- <service>
- <ID>nginx</ID>
- <name>nginx</name>
- <description>nginx</description>
- <executable>d:\balance_tomcat__nginx\nginx-1.6.0\nginx.exe</executable>
- <logpath>d:\balance_tomcat__nginx\nginx-1.6.0\logs\</logpath>
- <logmode>roll</logmode>
- <depend></depend>
- <startargument>-p D:\BALANCE_TOMCAT__NGINX\nginx-1.6.0</startargument >
- <stopargument>-p D:\BALANCE_TOMCAT__NGINX\nginx-1.6.0-s stop</stopargument>
- </Service>
<service> <id>nginx</id> <name>nginx</name> <description>nginx </description> <executable>D:\BALANCE_TOMCAT__NGINX\nginx-1.6.0\nginx.exe</executable> <logpath>D:\BALANCE_TOMCAT__NGINX\nginx-1.6.0\logs\</logpath> <logmode>roll</ logmode> <depend></depend> <startargument>-p D:\BALANCE_TOMCAT__NGINX\nginx-1.6.0 </startargument> <stopargument>-p D:\BALANCE_TOMCAT__NGINX\nginx-1.6.0-s stop</stopargument >
Note: If you install the service without modifying this file, the service cannot start. The following error will appear:
2. Setup setup for Windows service operation there is read.me open in the download file as follows:
[Plain]View Plaincopyprint?
- Ng_srv
- Installation for the Nginx server like a service.
- 1. Change in Ng_srv.xml path for your nginx path.
- 2. Launch "Ng_srvinst.bat Install" for service installation.
- 3. For uninstall launch "Ng_srvinst.bat remove".
- Thats all.
Ng_srvinstallation for Nginx server like a service.1. Change in Ng_srv.xml path for your nginx path.2. Launch "Ng_srvinst.bat Install" for service installation.3. For uninstall launch "Ng_srvinst.bat remove". Thats all.
The directory structure of the downloaded files is as follows: Install Ng_srvinst.bat as a system service, such as: After the installation is completed to see if the installation is successful, "Computer", "Management" and "services", you can see that the Nginx service has been successfully installed, such as: Reference Address:/HTTP blog.csdn.net/csfreebird/article/details/8751532
Installing Nginx as a Windows service self-starting run