zoukankan      html  css  js  c++  java
  • windows 设置nginx开机自启动

    将Nginx设置为Windows服务

    需要借助"Windows Service Wrapper"小工具,项目地址: https://github.com/kohsuke/winsw

    下载地址: http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/

    下载该工具后,将其放在 Nginx安装目录下,并重命名为nginx-service.exe,创建配置文件nginx-service.xml(名字要和工具名一样),

    创建nginx-service.exe.config(为支持NET 4.0 runtime,默认只支持NET 2.0 runtime)

    文件结构如下:

    nginx-service.xml 内容如下:  注意!!! .xml中nginx涉及到的路径中间不能有空格否则在Windows Server中会启动失败

    <service>   
        <id>nginx</id>   
        <name>Nginx Service</name>   
        <description>Nginx Service</description>   
        <logpath>D:SoftwarePackageNginxPage
    ginx-1.18.0logs</logpath>   
        <log mode="roll-by-size">     
            <sizeThreshold>10240</sizeThreshold>     
            <keepFiles>8</keepFiles>   
        </log>   
        <executable>D:SoftwarePackageNginxPage
    ginx-1.18.0
    ginx.exe</executable>   
        <startarguments>-p D:SoftwarePackageNginxPage
    ginx-1.18.0</startarguments>   
        <stopexecutable>D:SoftwarePackageNginxPage
    ginx-1.18.0
    ginx.exe</stopexecutable>   
        <stoparguments>-p D:SoftwarePackageNginxPage
    ginx-1.18.0 -s stop</stoparguments> 
    </service>

    nginx-service.exe.config 内容如下:

    <configuration>  
        <startup>    
            <supportedRuntime version="v2.0.50727" />    
            <supportedRuntime version="v4.0" />  
        </startup>  
        <runtime>    
            <generatePublisherEvidence enabled="false"/>   
        </runtime>
    </configuration>

    在安装Nginx的根目录里在cmd中运行如下命令安装windows服务

    D:SoftwarePackageNginxPage
    ginx-1.18.0
    ginx-service.exe install          

    之后就可以在Windows服务面板中启动服务了

    设置为自动启动后即可在浏览器正常访问了!

  • 相关阅读:
    adb命令之adb install
    GNU make and Makefile
    Makefile经典教程(掌握这些足够)
    Android.mk简介
    PhoneFactory.getDefaultPhone must be called from Looper thread
    Android源码目录结构
    软件部通用技术类网站名录
    β测试
    α测试
    白盒测试
  • 原文地址:https://www.cnblogs.com/Jack-Cheng008/p/14662622.html
Copyright © 2011-2022 走看看