当前位置:首页 > nginx > 正文

windows nginx开机自启动(windows nginx开机自启)

  • nginx
  • 2024-03-21 15:33:42
  • 1613
Windows Nginx 开机自启动
要素:

1. 创建 Nginx 服务:使用 Nginx 配置文件创建 Windows 服务。
2. 设置注册表项:修改注册表以将 Nginx 服务添加到系统服务列表。
3. 启动服务:使用命令行或管理工具启动 Nginx 服务。
4. 将服务配置为自动启动:修改服务属性以在系统启动时自动启动 Nginx。
示例:
1. 创建 Nginx 服务:
sc create nginx binPath= "C:\nginx\nginx.exe" displayName= "Nginx" start= "auto"
2. 设置注册表项:
reg add "HKLM\System\CurrentControlSet\Services\nginx" /v Startup /t REG_DWORD /d 2
3. 启动服务:
net start nginx
4. 配置自动启动:
打开服务管理工具(services.msc),找到 "Nginx" 服务,右键单击并选择 "属性",然后在 "常规" 选项卡下,将 "启动类型" 设置为 "自动"。