在Windows平台上安装Nginx并设置开机自动启动服务
一、下载安装
到Nginx官网下载并安装

二、安装系统服务,让开机自动运行
1、需要借助"Windows Service Wrapper"小工具,将下载的winsw-1.18-bin.exe放在 Nginx安装目录下,并重命名为nginx-service.exe
2、创建nginx-service.exe.config,内容如下:
<configuration> <startup> <supportedRuntime version="v2.0.50727" /> <supportedRuntime version="v4.0" /> </startup> <runtime> <generatePublisherEvidence enabled="false"/> </runtime> </configuration>
3、创建配置文件nginx-service.xml,内容如下:
<service> <id>nginx</id> <name>Nginx Service</name> <description>High Performance Nginx Service</description> <logpath>D:\nginx-1.14.2\logs</logpath> <log mode="roll-by-size"> <sizeThreshold>10240</sizeThreshold> <keepFiles>8</keepFiles> </log> <executable>D:\nginx-1.14.2\nginx.exe</executable> <startarguments>-p D:\nginx-1.14.2</startarguments> <stopexecutable>D:\nginx-1.14.2\nginx.exe</stopexecutable> <stoparguments>-p D:\nginx-1.14.2 -s stop</stoparguments> </service>
4、在cmd管理员方式中运行如下命令安装windows服务
D:\nginx-1.14.2\nginx-service.exe install
相关推荐
-
MySQL进阶垫脚石:线程长时间处于killed状态怎么破?
MySQL进阶垫脚石:线程长时间处于killed状态怎么破?2025-04-30 01:10:02 -
「你真的知道吗?」Mysql中的DDL, DML, DCL, 和TCL介绍
「你真的知道吗?」Mysql中的DDL, DML, DCL, 和TCL介绍2025-04-30 00:52:57 -
PHP页面跳转2025-04-30 00:44:40
-
php调用自己的方法报错5002025-04-30 00:16:34
-
MYSQL常用查询Columns和Views2025-04-30 00:14:51