NGINX开机自动启动
借助Windows Service Wrapper工具,将Nginx转换为Windows服务,在服务中心配置自启动,从而在开机时windows自行启动Nginx服务。
1、自启动工具下载 工具下载地址:https://github.com/winsw/winsw/releases

2、自启动工具安装
下载后将该工具放入Nginx的安装目录下,并且将其重命名为nginx-service.exe 2)在nginx安装目录下新建服务日志文件夹server-logs文件夹,用来存放nginx服务相关日志 3)在该目录下新建 nginx-service.xml 文件,写入配置信息,配置好了之后可以将nginx注册为Windows服务 文件配置内容如下:日志文件位置 启动命令关闭命令
<!-- nginx-service.xml --> <service> <id>nginx</id> <name>nginx</name> <description>nginx</description> <logpath>E:\nginx-1.22.0\server-logs\</logpath> <logmode>roll</logmode> <depend></depend> <executable>E:\nginx-1.22.0\nginx.exe</executable> <stopexecutable>E:\nginx-1.22.0\nginx.exe -s stop</stopexecutable> </service>
配置完成后nginx目录:

3、把nginx注册为windows服务
在nginx安装目录下以管理员运行命令:.\nginx-service.exe install 将其注册为Windows服务,检查注册结果。
设置nginx为登录用户模式支持reload模式:

将启动方式修改为自启动,启动nginx服务。

nginx reload 参考命令:

nginx其他命令 注册系统服务命令 nginx-service.exe install 删除已注册的系统服务命令 nginx-service.exe uninstall 停止对应的系统服务命令 nginx-service.exe stop 启动对应的系统服务命令 nginx-service.exe start
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!