zoukankan      html  css  js  c++  java
  • 将Nginx添加到windows服务中

    1. 下载windows版nginx,解压。
    2. 下载一个安装工具winsw-1.18-bin.exe.点击下载
    3. 下载后改个名字:service.exe,放到nginx目录下。
    4. 在nginx安装目录下新建service.xml
      nginx-path为nginx根目录,注意修改为自己的目录,下面的id为服务名称,用来删除服务。
    <service> 
        <id>nginx-load-balance</id>
        <name>NginxLoadBanlanceService</name>
        <description>使用nginx负载均衡</description>
          <logpath>nginx-pathlogs</logpath>  
        <log mode="roll-by-size">   
            <sizeThreshold>10240</sizeThreshold>
            <keepFiles>8</keepFiles>
        </log>
          <executable>nginx-path
    ginx.exe</executable>  
        <startarguments>-p nginx-path</startarguments>
        <stopexecutable>nginx-path
    ginx.exe</stopexecutable>
        <stoparguments>-p nginx-path -s stop</stoparguments>
    </service>
    
    1. 新建service.exe.config配置文件。
    <configuration>
      <startup>
            <supportedRuntime version="v2.0.50727" />     <supportedRuntime version="v4.0" />
       </startup>
       <runtime>
            <generatePublisherEvidence enabled="false"/>
        </runtime>
    </configuration>
    
    1. 最后目录结构。
      在这里插入图片描述
    2. nginx的根目录打开dos,输入命令:service.exe install。
    3. 查看windows服务列表,启动。
      在这里插入图片描述
    4. 访问
      在这里插入图片描述
    5. 如何删除服务?在dos输入:sc delete nginx-load-balance。
    只有把命运掌握在自己手中,从今天起开始努力,即使暂时看不到希望,也要相信自己。因为比你牛几倍的人,依然在努力。
  • 相关阅读:
    ros 录制
    shell 截取字符串
    Linux 关机
    shell获取字符串长度
    ubuntu14.04 设置开机自启动脚本
    获取本机ip的shell脚本
    shell 杀掉指定进程的服务
    html 绘制矩形轨迹,选中区域
    shell模拟ctrl c停止
    shell 字符串提取数字
  • 原文地址:https://www.cnblogs.com/freesky168/p/14358191.html
Copyright © 2011-2022 走看看