nginx for windows: 让nginx以服务的方式运行(亲侧修正)
2009-12-10 09:12
561 查看
在windows下安装了nginx, 郁闷是发现它没有以服务方式运行, 也就是说当用户注销后,程序
会终止.因此需要将nginx作为服务运行.
假设nginx安装在c:\nginx\下:
1.下载微软服务注册工具srvany.exe, instsrv.exe, 存放到c:\nginx\目录下
http://wesoho.com/soft/down/srvany.rar
2.安装NGINX服务, 将命令行切换到c:\nginx\,执行下列命令
instsrv NGINX c:\nginx\srvany.exe 没错就是srvany.exe
3.在c:\nginx\下,编辑一个nginx.reg文件(这一步我遇到了问题,导入不成功)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NGINX\Parameters]
"Application"="C:\\nginx\\nginx.exe"
"AppParameters"=""
"AppDirectory"="C:\\nginx\\"
5.让服务与程序关联起来, 命令行执行
regedit /s nginx.reg
上面这个执行失败的解决办法:运行regedit打开注册表,直接在[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NGINX下添加Parameters一项,然后手动建立三个字符串的注册表值,就是上面这三个Application AppParameters AppDirectory
6.编辑启动nginx脚本start-nginx.bat(关闭脚本不用变), 让程序以服务方式运行
@ECHO OFF
net stop nginx
net start nginx
EXIT
经过上面的步骤,顺利启动nginx服务,另外添加服务还有一个图形界面的工具SRVINSTW.EXE
会终止.因此需要将nginx作为服务运行.
假设nginx安装在c:\nginx\下:
1.下载微软服务注册工具srvany.exe, instsrv.exe, 存放到c:\nginx\目录下
http://wesoho.com/soft/down/srvany.rar
2.安装NGINX服务, 将命令行切换到c:\nginx\,执行下列命令
instsrv NGINX c:\nginx\srvany.exe 没错就是srvany.exe
3.在c:\nginx\下,编辑一个nginx.reg文件(这一步我遇到了问题,导入不成功)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NGINX\Parameters]
"Application"="C:\\nginx\\nginx.exe"
"AppParameters"=""
"AppDirectory"="C:\\nginx\\"
5.让服务与程序关联起来, 命令行执行
regedit /s nginx.reg
上面这个执行失败的解决办法:运行regedit打开注册表,直接在[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NGINX下添加Parameters一项,然后手动建立三个字符串的注册表值,就是上面这三个Application AppParameters AppDirectory
6.编辑启动nginx脚本start-nginx.bat(关闭脚本不用变), 让程序以服务方式运行
@ECHO OFF
net stop nginx
net start nginx
EXIT
经过上面的步骤,顺利启动nginx服务,另外添加服务还有一个图形界面的工具SRVINSTW.EXE
相关文章推荐
- nginx for windows: 让nginx以服务的方式运行(亲侧修正)
- nginx for windows: 让nginx以服务的方式运行
- 【转载】nginx for windows: 让nginx以服务的方式运行
- Windows下Nginx以服务的方式运行
- 以服务方式运行Apache for Windows
- Windows下Nginx以服务的方式运行
- 以服务方式运行Apache for Windows
- nginx/windows: 让nginx以服务的方式运行
- 以服务方式运行Apache for Windows
- 以Windows服务方式运行ASP.NET Core程序【转载】
- 使用Apache Commons Daemon 来实现Jetty7 以Windows 服务方式运行
- 在Windows上以服务方式运行 MSOPenTech/Redis
- 在Windows上以服务方式运行 Redis
- Windows下将nginx安装为服务运行
- MongoDB 3.4 安装以 Windows 服务方式运行的详细步骤
- 自己动手搭建Nginx+memcache+xdebug+php运行环境绿色版 For windows版
- OpenOffice3.0以服务方式运行在Windows平台(文件转换服务器解决方案)
- Confluence 6 Windows 中以服务方式自动重启修改运行服务的用户
- MongoDB 3.4 安装以 Windows 服务方式运行
- 以 Console 方式运行、调试、编译 .Net 编写的 Windows 服务