Quick way to install nginx as windows service, 5 minutes to read.
Get Nginx
- Latest version http://nginx.org/en/docs/windows.html
Extact to local path
I would prefer put in C drive.
C:\server\nginx
Install as service
- Download the latest version of Windows Service Wrapper via github or nuget
- Rename
winsw-*.exe
to something likenginx-service.exe
and place it in nginx folder
- Add a
nginx-service.xml
in same follow as folllowing content
<!-- install command: nginx-service.exe install --> <!-- uninstall command: nginx-service.exe uninstall --> <service> <id>nginx</id> <name>nginx</name> <description>nginx</description> <executable>C:\server\nginx\nginx.exe</executable> <logpath>C:\server\nginx\</logpath> <logmode>roll</logmode> <depend></depend> <startargument>-p</startargument> <startargument>C:\server\nginx</startargument> <stopexecutable>C:\server\nginx\nginx.exe</stopexecutable> <stopargument>-p</stopargument> <stopargument>C:\server\nginx</stopargument> <stopargument>-s</stopargument> <stopargument>stop</stopargument> </service>
- Open an admin command window and run
nginx-service install
from nginx folder.
- Now start the nginx from service window.