将nginx安装为windows服务
nginx 常用操作命令
start nginx
tasklist /fi "imagename eq nginx.exe"
nginx -s stop fast shutdown
nginx -s quit graceful shutdown
nginx -s reload changing configuration,starting new worker processes with a new configuration,graceful shutdown of old worker processes
nginx -s reopen re-opening log files
nginx 安装为windows服务
-
下载Windows Service Wrapper工具,选择合适版本下载,该工具可设置nginx为windows服务。
-
下载后把下载的winsw-2.1.2-bin.exe 文件放在Nginx安装目录(C:\Program Files\Nginx),并修改名称为nginx-service.exe,然后分别创建nginx-service.exe.config,nginx-service.xml文件,把这两个文件放在Nginx安装目录下。
-
nginx-service.exe.config内容如下:
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
<supportedRuntime version="v4.0" />
</startup>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>
- nginx-service.xml内容如下(根据实际情况对路径进行调整):
<service>
<id>nginx</id>
<name>Nginx Service</name>
<description>High Performance Nginx Service</description>
<logpath>C:\Program Files\Nginx\logs</logpath>
<log mode="roll-by-size">
<sizeThreshold>10240</sizeThreshold>
<keepFiles>8</keepFiles>
</log>
<executable>C:\Program Files\Nginx\nginx.exe</executable>
<startarguments>-p C:\Program Files\Nginx</startarguments>
<stopexecutable>C:\Program Files\Nginx\nginx.exe</stopexecutable>
<stoparguments>-p C:\Program Files\Nginx -s stop</stoparguments>
</service>
安装nginx服务 nginx-service.exe install
删除nginx服务 sc delete 服务名
本文为原创文章,想了解更多信息欢迎访问我的博客
https://www.cnblogs.com/ihappycat/