zoukankan      html  css  js  c++  java
  • windows下nginx以服务自启动

    1.下载最新版的 Windows Service Wrapper 程序

        https://github.com/kohsuke/winsw/releases

    2.可以修改它的名字,例如:myapp.exe 将重命名后的 myapp.exe 复制到 nginx 的安装目录

    3. 在同一个nginx目录下创建一个Windows Service Wrapper的XML配置文件,名称必须与第一步重命名时使用的名称一致(比如我这里是 "myapp.xml")

    myapp.xml的文件内容如下:

    复制代码

    <configuration>

      <!-- ID of the service. It should be unique accross the Windows system-->
      <id>nginx</id>

      <!-- Display name of the service -->
      <name>Nginx Service 1.12.2</name>

      <!-- Service description -->
      <description>High Performance Nginx Service</description>

      <executable>C: ginx ginx.exe</executable>

    </configuration>

    复制代码

    4,命令行下执行以下命令,以便将其安装成Windows服务。

    D:NeatbeansSoftsRedis-x64-3.2.100> myapp.exe install

    至此,完工,确认一下:我的电脑 右键 -> 管理 -> 服务 -> 是否有了个 nginx 呢?启动起来,

    在浏览器中 访问 http://localhost 确认一下,再 停止服务,再访问一下  http://localhost 确认一下。 

    补充:
    Windows Servcie Wrapper的命令格式如下:
     
    # 安装服务

    D:NeatbeansSoftsRedis-x64-3.2.100> myapp.exe install

     # 卸载服务

    D:NeatbeansSoftsRedis-x64-3.2.100> myapp.exe uninstall

     # 启动服务

    D:NeatbeansSoftsRedis-x64-3.2.100> myapp.exe start

     # 停止服务

    D:NeatbeansSoftsRedis-x64-3.2.100> myapp.exe stop
  • 相关阅读:
    Java多线程(二)关于多线程的CPU密集型和IO密集型这件事
    Java 过一下基础
    日历打印用java实现
    DAY8-打卡第八天-2018-1-18
    web-day1-初识标识符
    DAY7-图形界面第一弹-2018-1-17
    四种排序方法用java实现
    DAY6-小变化(java提示框)-2018-1-16
    DAY5-小别-2018-1-15
    DAY4-打卡第四天-2018-1-12
  • 原文地址:https://www.cnblogs.com/wangfeixiong/p/8929130.html
Copyright © 2011-2022 走看看