安裝Nginx為Windows service

來源:互聯網
上載者:User

安裝目標系統是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:\cloud_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調用成功了。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.