Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#209 closed enhancement (invalid)

How to Install nginx as a Service on Windows

Reported by: www.google.com/accounts/o8/id?id=AItOawkziFQ7uQ0DIeb7dVeueseDcte9SWuGLvo Owned by: somebody
Priority: minor Milestone:
Component: nginx-core Version: 1.3.x
Keywords: Cc:
uname -a:
nginx -V: 1.3.5

Description

Create service folder:

C:\Program Files\nginx-1.3.5\service

install.bat:
sc create nginxSvc binPath= "C:\Program Files\nginx-1.3.5\service\srvany.exe" start= auto DisplayName?= "nginx Service"
REG ADD "HKLM\SYSTEM\CurrentControlSet?\Services\nginxSvc\Parameters" /v Application /t REG_SZ /d "C:\Program Files\nginx-1.3.5\service\service.bat" /f
sc start nginxSvc

service.bat:
:LOOP
echo Starting nginx Service
C:
cd "\Program Files\nginx-1.3.5\"
"C:\Program Files\nginx-1.3.5\nginx.exe"
SLEEP 1
GOTO LOOP

uninstall.bat:
echo Stopping nginx Service
C:
cd "\Program Files\nginx-1.3.5\"
"C:\Program Files\nginx-1.3.5\nginx.exe" -s stop
sc stop nginxSvc
sc delete nginxSvc

Download srvany.exe and put it in the folder.

Br Johan Carstensen

Attachments (1)

service.zip (4.7 KB) - added by www.google.com/accounts/o8/id?id=AItOawkziFQ7uQ0DIeb7dVeueseDcte9SWuGLvo 6 years ago.

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by www.google.com/accounts/o8/id?id=AItOawkziFQ7uQ0DIeb7dVeueseDcte9SWuGLvo

comment:1 Changed 6 years ago by mdounin

  • Resolution set to invalid
  • Status changed from new to closed

There is more than one way to create user-defined services on windows, including this one, documented by Microsoft here. Though in any case this doesn't belong to nginx-core, and we certainly don't want to distribute srvany.exe (and I actually think we can't from legal point of view). Though probably deserve link somewhere in the documentation.

You may also want to provide some details/example scripts somewhere near http://wiki.nginx.org/InitScripts, much like it's already done for may other OSes. Please don't include srvany.exe though, provide a link to official download page instead.

comment:2 Changed 5 years ago by psomodi@…

Hi!
I've created a nginx installer for windows using an open source alternative to srvany.
If you want to take a look: https://github.com/InvGate/winginx

Note: See TracTickets for help on using tickets.