Windows提供了两个小工具instsrv.exe和srvany.exe来把任何应用包装成windows服务。顾名思义instsrv(install service)是用来安装服务的,而srvany(service anything)包装任何服务的外壳。下载instsrv.exe和srvany.exe.java
因为nginx的windows应用没有服务,使用起来不太方便,这里趁机利用一下把nginx安装成windows服务,步骤以下:nginx
Installs and removes system services from NT INSTSRV <service name> (<exe location> | REMOVE) [-a <Account Name>] [-p <Account Password>] Install service example: INSTSRV MyService C:\MyDir\DiskService.Exe -OR- INSTSRV MyService C:\mailsrv\mailsrv.exe -a MYDOMAIN\joebob -p foo Remove service example: INSTSRV MyService REMOVE
instsrv.exe nginx e:\temp\clean_day\nginx-1.4.7\srvany.exe
若是为了方便,你也能够作成bat文件,包括安装、卸载、启动、中止,甚至于操做注册表。有兴趣的同窗本身尝试一下。windows