你好,游客 登录
背景:
阅读新闻

安装Nginx为Windows service - sheismylife的专栏

[日期:2013-04-02] 来源:  作者: [字体: ]

安装目标系统是windows 7

首先看了这篇文章:http://blog.csdn.net/defonds/article/details/7906005

里面推荐winsw作为注册服务的工具,的确不错。该项目主页在:https://github.com/kohsuke/winsw

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

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

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


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

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

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

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

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

<service>  
  <id>nginx</id>  
  <name>nginx</name>  
  <description>nginx</description>  
  <executable>cloud-engine-home\nginx\nginx.exe</executable>
  <logpath>cloud-engine-home\nginx\logs\</logpath>
  <logmode>roll</logmode>
  <depend></depend>
  <startargument>-p cloud-engine-home\nginx</startargument>
  <stopargument>-p cloud-engine-home\nginx -s stop</stopargument>
</service>

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

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






收藏 推荐 打印 | 录入:admin | 阅读:
相关新闻