Installing Nginx as a Windows service self-starting run

Source: Internet
Author: User
Tags nginx server

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?
  1. <service>
  2. <ID>nginx</ID>
  3. <name>nginx</name>
  4. <description>nginx</description>
  5. <executable>d:\www\nginx\nginx.exe</executable>
  6. <logpath>d:\www\logs\</logpath>
  7. <logmode>roll</logmode>
  8. <depend></depend>
  9. <startargument>-p d:\www\nginx</startargument>
  10. <stopargument>-p d:\www\nginx-s stop</stopargument>
  11. </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?
  1. <service>
  2. <ID>nginx</ID>
  3. <name>nginx</name>
  4. <description>nginx</description>
  5. <executable>d:\balance_tomcat__nginx\nginx-1.6.0\nginx.exe</executable>
  6. <logpath>d:\balance_tomcat__nginx\nginx-1.6.0\logs\</logpath>
  7. <logmode>roll</logmode>
  8. <depend></depend>
  9. <startargument>-p D:\BALANCE_TOMCAT__NGINX\nginx-1.6.0</startargument >
  10. <stopargument>-p D:\BALANCE_TOMCAT__NGINX\nginx-1.6.0-s stop</stopargument>
  11. </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?
    1. Ng_srv
    2. Installation for the Nginx server like a service.
    3. 1. Change in Ng_srv.xml path for your nginx path.
    4. 2. Launch "Ng_srvinst.bat Install" for service installation.
    5. 3. For uninstall launch "Ng_srvinst.bat remove".
    6. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.