I set up NGINX as a front end server for static content and I use Apache as a back-end server for other thing.
The thing is I can't find a logical answer that allows me to make nginx.exe
a Windows system service (like my Apache).
Any come across an answer to this?
Download zip file from here.
Extract
nginx-service.exe
fromwinginx\build
and run it.The easiest way I've found, was using the Chocolatey package manager.
Once Chocolatey is installed, you open an administrative prompt and type:
You now have a Windows service named 'nginx' running.
start.bat
stop.bat
Official nginx wiki referes on winginx for this purpose. It builds exe-installer in linux environment. Process looks like this:
To get actual versions you should specify them in
Makefile
.SC.EXE will only work for executables that already support the Windows Services API and can respond properly to start and stop requests from the Services Control Manager (SCM). Other regular applications, not specifically written as a service, will simply fail to start (usually with error 1053)...
For those exe's, you need a "service wrapper" -- a small utility that can accept the start/stop commands from the SCM and run/terminate your application accordingly. Microsoft provides Srvany (which is free yet very basic), but there are several other free and commercial alternatives.
BTW, you should check out this guide showing how to run Nginix as a service, especially step 7 which discusses how to stop Nginix properly. Not every wrapper will support that functionality (Srvany doesn't)...
Download NSSM form http://nssm.cc/download . "Run %NSSM_HOME%\nssm.exe install “Nginx”"
Select the Nginx executable in the NSSM dialog, then OK. Go to Services and start the new created service "Nginx", done.