SpringBlade 将nginx添加到服务

原文:
https://www.cnblogs.com/lujiulong/p/9025066.html

一、下载Windows Service Wrapper

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

二、放在nginx目录下,并修改名字为nginx-service.exe

三、创建配置文件nginx-service.exe.confignginx-service.xml

1、nginx-service.xml

<service>
  <id>nginx</id>
  <name>Nginx Service</name>
  <description>High Performance Nginx Service</description>
  <logpath>C:\nginx-1.14.0\logs</logpath>
  <log mode="roll-by-size">
    <sizeThreshold>10240</sizeThreshold>
    <keepFiles>8</keepFiles>
  </log>
  <executable>C:\nginx-1.14.0\nginx.exe</executable>
  <startarguments>-p C:\nginx-1.14.0</startarguments>
  <stopexecutable>C:\nginx-1.14.0\nginx.exe</stopexecutable>
  <stoparguments>-p C:\nginx-1.14.0 -s stop</stoparguments>
</service>

2、nginx-service.exe.config

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

四、在cmd中执行命令

nginx-service.exe install
net start nginx

posted @ 2020-11-27 10:52  古兴越  阅读(238)  评论(0编辑  收藏  举报