Windows service安装Nginx

手册/FAQ (297) 2016-04-29 09:37:42

 

使用方法很简单,下载exe文件,重命名为install.exe,然后创建一个install.xml文件,根据主页上介绍的填好设置。

运行后的确成功。但是不能在newlisp程序的exec中调用,始终报下面的错误

  1. annot start service from the command line or a debugger ...  

 

然后试用.net带来的intallutil.exe,不行,始终报找不到assembly的错误:

  1. Exception occurred while initializing the installation:  
  2. System.BadImageFormatException: Could not load file or assembly 'file:///c:\clou  
  3. d_engine\nginx\nginx.exe' or one of its dependencies. The module was expected to  
  4.  contain an assembly manifest..  

最后找到这个:http://ng-srvinst.attron.org/

下载压缩包,解压后看一下read.me, 非常简单。

不过要注意ng_srv.xml文件最后的两项配置:

  1. <service>    
  2.   <id>nginx</id>    
  3.   <name>nginx</name>    
  4.   <description>nginx</description>    
  5.   <executable>cloud-engine-home\nginx\nginx.exe</executable>  
  6.   <logpath>cloud-engine-home\nginx\logs\</logpath>  
  7.   <logmode>roll</logmode>  
  8.   <depend></depend>  
  9.   <startargument>-p cloud-engine-home\nginx</startargument>  
  10.   <stopargument>-p cloud-engine-home\nginx -s stop</stopargument>  
  11. </service>  

-p 后面是Nginx目录,如果写成nginx.exe路径就错了,会造成nginx 服务无法启动。

现在newlisp中通过exec调用成功了。

THE END