I am trying to run nginx (reverse proxy) as a windows service so that it's possible to proxy a request even when a user is not connected.
I searched a lot around and found winsw that should create a service from an .exe file (such as nginx).
I found many tutorials online saying to create an xml file as following
<service>
<id>nginx</id>
<name>nginx</name>
<description>nginx</description>
<executable>c:\nginx\nginx.exe</executable>
<logpath>c:\nginx\</logpath>
<logmode>roll</logmode>
<depend></depend>
<startargument>-p c:\nginx</startargument>
<stopargument>-p c:\nginx -s stop</stopargument>
</service>
(I have nginx.exe
in a folder called nginx under c: o the paths are correct).
Now the problem is that the service is created but I can't seem to make it start, every time I try to start it, a window pops up saying
Error 1053: The service didn't respond to the start or control request in a timely fashion
Does anyone know how can I fix this or a different way to run Nginx as a Window service?
Just stumbled here and managed to get things working with this free open source alternative: https://nssm.cc/
It basically is just a GUI to help you create a service. Steps I used:
nssm install nginx
from the command linestart nginx
on the Input (stdin) field. Optionally set C:\foobar\nginx\logs\service.out.log and C:\foobar\nginx\logs\service.err.log in the output and error slots.You should be good to go from then on.