zoukankan      html  css  js  c++  java
  • 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命令是否以管理员身份打开的。

  • 相关阅读:
    【C#高级】泛型(一)
    【C#】RGB转CMYK
    C#读写Excel
    H5+MUI上传文件
    完整登录流程包含第三方登录,很详细值得推荐
    [MVC]多文件、超大文件上传
    [SQL Server] 无法连接到本地数据库
    “System.OutOfMemoryException”类型的异常在 mscorlib.dll 中发生,但未在用户代码中进行处理
    MVC缓存(二)
    MVC缓存(一)
  • 原文地址:https://www.cnblogs.com/telwanggs/p/15114584.html
Copyright © 2011-2022 走看看