• Windows安装nginx服务


    1、测试版本

      nginx版本:nginx-1.10.2;windows版本:win10

    2、下载winsw。

      当前最新版本为:winsw-2.0.1-bin.exe。下载地址:http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/2.0.1/winsw-2.0.1-bin.exe。

    3、将winsw-2.0.1-bin.exe复制到nginx目录下(保证nginx的目录不含空格),并重命名为nginx-service.exe。

    4、在nginx目录下新增文件nginx-service.xml。

    <?xml version="1.0" encoding="UTF-8" ?>
    <service>
        <id>nginx</id>
        <name>nginx</name>
        <description>High Performance Nginx Service</description>
        <logpath>D:
    ginx-1.10.2logs</logpath>
        <log mode="roll-by-size">
            <sizeThreshold>10240</sizeThreshold>
            <keepFiles>8</keepFiles>
        </log>
        <executable>D:
    ginx-1.10.2
    ginx.exe</executable>
        <startarguments>-p D:
    ginx-1.10.2</startarguments>
        <stopexecutable>D:
    ginx-1.10.2
    ginx.exe</stopexecutable>
        <stoparguments>-p D:
    ginx-1.10.2 -s stop</stoparguments>
    </service>

    5、在nginx目录下新增文件nginx-service.exe.xml

    <?xml version="1.0" encoding="UTF-8" ?>
    <configuration>
        <startup>
            <supportedRuntime version="v2.0.50727" />
            <supportedRuntime version="v4.0" />
        </startup>
        <runtime>
            <generatePublisherEvidence enabled="false" />
        </runtime>
    </configuration>

    6、文件结构如下:

    7、启用windows自带的.Net Framework服务。

    8、使用管理员身份运行cmd。

      右键“C:WindowsSystem32cmd.exe”,选择“已管理员身份运行”。

    9、运行命令:nginx-service.exe install。

    执行完成后可以查看nginx服务

    10、启动nginx,访问nginx成功。

    11、卸载nginx服务,在cmd命令窗口下执行:nginx-service.exe uninstall。

    提示:1、若出现“WMI.WmiException: AccessDenied”错误,请检测cmd命令是否以管理员身份打开的。

  • 相关阅读:
    用纹理贴图模拟反射,NeHe23课球面映射相关
    VS2010: CommandLine Warning D9025
    【转】C RunTime Library 暨 深入理解编译选项的含义 01
    让Doxygen输出中文注释不乱码
    windows环境下memcache配置
    C#中英文字符长度截取
    apache 的工作原理
    pear包安装phpunit
    使用 libevent 和 libev 提高网络应用性能
    PHP发明人谈MVC和网站设计架构——貌似他不支持php用mvc
  • 原文地址:https://www.cnblogs.com/zhi-leaf/p/6274290.html
Copyright © 2020-2023  润新知