Home >Backend Development >PHP Tutorial >Install Nginx to run automatically as a Windows service

Install Nginx to run automatically as a Windows service

WBOY
WBOYOriginal
2016-08-08 09:27:471057browse
It is really troublesome if Nginx needs to be started manually every time it is used, so it is best to set it as a Windows system service and just start it automatically after booting. 1. Download and modify the operating environment support program 1), download address: http://ng-srvinst.attron.org/2), modify the content of ng_srv.xml file:
  1. service> id>
  2. ​​​
  3. <name>nginxname> description
  4. >
  5. nginxexecutable>​​ <logpath
  6. >
  7. d:wwwlogslogpath> logmode>roll< ;/logmode>
  8.                                                      < startargument> >-p d:wwwnginx -s stop
  9. stop argument
  10. > Change the Nginx directory of the above files to your own machine The directory where Nginx is located. My Nginx version is 1.6.0, the modified file is as follows:
    1. <service>    
    2.  <id>nginxid>    
    3.   <name>nginxname>    
    4.   <description>nginxdescription>    
    5.   <executable>D:BALANCE_TOMCAT__NGINXnginx-1.6.0nginx.exeexecutable>    
    6.   <logpath>D:BALANCE_TOMCAT__NGINXnginx-1.6.0logslogpath>    
    7.   <logmode>rolllogmode>    
    8.   <depend>depend>    
    9.   <startargument>-p D:BALANCE_TOMCAT__NGINXnginx-1.6.0startargument>    
    10.   <stopargument>-p D:BALANCE_TOMCAT__NGINXnginx-1.6.0 -s stopstopargument>    
    11. service>   

    注:如果未修改此文件就安装服务,服务无法启动。会出现如下错误:

  11. 2.安装程序设置为Windows服务操作在下载文件中有read.me打开之内容如下:
    1. NG_SRV  
    2.   
    3. Installation for nginx server like a service.  
    4.   
    5. 1. Change in ng_srv.xml path for your nginx path.  
    6. 2. Launch "ng_srvinst.bat install" for service installation.  
    7.   
    8. 3. For uninstall launch "ng_srvinst.bat remove".  
    9.   
    10. Thats all.  
    下载文件的目录结构如下:将ng_srvinst.bat安装为系统服务,如下图:
    安装完成后查看是否安装成功“计算机”->"管理"->"服务",你可以看到Nginx服务已经安装成功,如下图:

    Reference address: http://blog.csdn.net/csfreebird/article/details/8751532

    The above introduces the installation of Nginx as a Windows service to run automatically, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn