• Windows Server 2008 R2下将nginx安装成windows系统服务


    一直在Linux平台上部署web服务,但是最近的一个项目,必须要用windows,不得已再次研究了nginx在windows下的表现,因为Apache httpd在Windows下表现其实也不算太好,而我更喜欢nginx。

    惊奇地发现nginx在Windows下已经趋于稳定,于是我决定使用nginx作为web服务器。

    到nginx下载页面,即可发现对应的版本可下载:http://nginx.org/en/download.html

    下载完成后放到指定目录,如D: ginx。

    将nginx安装成服务,我们需要用到一个软件:Windows Service Wrapper,这个软件也是开源的,而且已经很久没有更新了,我找到的最后版本是1.9。下载地址需要百度。

    下载后,将winsw-1.9-bin.exe文件复制到nginx的winsw文件夹下(没有就创建咯)。

    创建一个同名的xml文件,winsw-1.9-bin.xml 内容如下:

    <?xml version="1.0" encoding="UTF-8" ?>
    <service>
    <id>nginx</id>
    <name>nginx</name>
    <description>nginx</description>
    <executable>D:
    ginx
    ginx.exe</executable>
    <logpath>D:
    ginx</logpath>
    <logmode>roll</logmode>
    <depend></depend>
    <startargument>-p D:
    ginx</startargument>
    <stopargument>-p D:
    ginx -s stop</stopargument>
    </service>

    以管理员身份运行cmd,输入:D: ginxwinswwinsw-1.9-bin.exe install,回车,提示安装服务完成。

    此时,你的nginx可以以Windows服务运行了,可以打开服务管理器进行服务的启动、停止、修改自动或手动运行等,更可以使用Windows的cmd命令:net start/stop nginx来管理。是不是很方便呢?

    我参考了这篇文章:http://blog.163.com/whhlcj@126/blog/static/38702877201361952417699/

  • 相关阅读:
    322. Coin Change
    368.[LeetCode] Largest Divisible Subset
    c++
    python 循环
    2018今日头条
    c++中set的用法
    [LeetCode]48. Rotate Image 旋转图片
    [LeetCode]47. Permutations II
    [LeetCode]46. Permutations
    sys与os模块(转载)
  • 原文地址:https://www.cnblogs.com/luodengxiong/p/4630973.html
Copyright © 2020-2023  润新知