在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
相关推荐
-
DBA技术分享(一)-MYSQL常用查询Databases和tables
DBA技术分享(一)-MYSQL常用查询Databases和tables2025-04-27 02:23:34 -
SEO应用之PHP随机输出数组多个值2025-04-27 01:31:39
-
Hbase和MySQL的区别是什么?2025-04-27 01:13:13
-
PHP中异步执行http请求(Guzzle And Curl)
PHP中异步执行http请求(Guzzle And Curl)2025-04-27 00:21:51 -
| PHP 求2个日期相差天数,兼容性好错误率低,收藏了2025-04-27 00:15:34