标签:
如果Nginx每次使用都需要手动启动确实很麻烦,所以最好将其设置为Windows系统服务,开机自启动就行了。
1)、下载地址:http://ng-srvinst.attron.org/
2)、修改ng_srv.xml文件内容:
<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>
将上述文件的Nginx目录改为自己本机Nginx所在的目录。我的Nginx版本是1.6.0,修改后的文件如下:
<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>
注:如果未修改此文件就安装服务,服务无法启动。会出现如下错误:
NG_SRV Installation 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.下载文件的目录结构如下:
标签:
原文地址:http://www.cnblogs.com/wenus/p/4285980.html