【转载】nginx for windows: 让nginx以服务的方式运行
2011-11-29 09:31
645 查看
nginx for windows: 让nginx以服务的方式运行
在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 for windows: 让nginx以服务的方式运行
- nginx for windows: 让nginx以服务的方式运行(亲侧修正)
- nginx for windows: 让nginx以服务的方式运行(亲侧修正)
- 以服务方式运行Apache for Windows
- 以服务方式运行Apache for Windows
- 以服务方式运行Apache for Windows
- nginx/windows: 让nginx以服务的方式运行
- Windows下Nginx以服务的方式运行
- Windows下Nginx以服务的方式运行
- 以Windows服务方式运行ASP.NET Core程序【转载】
- (转)在Windows上以服务方式运行 MSOPenTech/Redis
- 自己动手搭建Nginx+memcache+xdebug+php运行环境绿色版 For windows版
- 自己动手搭建Nginx+memcache+xdebug+php运行环境绿色版 For windows版
- windows环境下用nginx+FastCGI方式运行Django
- 在Windows上以服务方式运行 MSOPenTech/Redis
- windows下安装设置Nginx+python+flup+django,并设为服务运行!
- nginx for windows之反向代理(转载)
- 把Nginx注册成Windows 系统服务(转载)
- 安装Nginx作为Windows服务自启动运行
- 在Windows上以服务方式运行 MSOPenTech/Redis