Welcome! Log In Create A New Profile

Advanced

How to add nginx system for a windows service?

Posted by netgod 
How to add nginx system for a windows service?
May 31, 2009 03:08AM
In the windows operating system, how to add nginx system for a windows service?
Re: How to add nginx system for a windows service?
June 11, 2009 07:20AM
I am wondering too.

Referring to Kevin's work : http://www.kevinworthington.com/nginx-for-windows/ I see that "start_nginx.bar just calls nginx.exe, and stop_nginx.bat just kills the process (process -k nginx.exe).

I tried the following but starting the service gives me a 1053 error code.

[code]
sc.exe create nginx binpath= "C:\nginx-0.7.59\nginx.exe" displayname= "http server nginx" depend= Tcpip start= auto obj= "NT AUTHORITY\LocalService"
[/code]

I'm going to have a look towards srvany.exe (MS tool to create a service) and will tell you what I find out.

Barbara
Re: How to add nginx system for a windows service?
June 11, 2009 07:53AM
I didn't find anything relevant to MS Vista for now (only shareware, because Vista doesn't provide instsrv.exe/srvany.exe). I may search again later.
Re: How to add nginx system for a windows service?
September 02, 2009 10:15AM
Hi,

I managed to add nginx as a Windows service using srvany.exe but it didn't behave how I'd like it too. It wouldn't stop all the nginx.exe processes, only the one it started.

I even tried using the Windows version of Lighttpd service process to start nginx instead and it too left the extra processes running.

Is there any update from Igor on Windows Service support? It's the only thing holding me back from using nginx.

Maybe someone with enough programming knowledge could knock together a service process for nginx. I doubt it'd take much for an experienced programmer to create a service to run nginx.exe on a start and execute "nginx.exe stop" on a stop etc...
Re: How to add nginx system for a windows service?
September 09, 2009 02:35PM
I wrote a tutorial about this a few months ago.

You can find it at http://forums.firedaemon.com/nginx-web-server-t534.html

FireDaemon is compatible with 2000 / XP / Vista / 2003 / 2008 / 7.

Pro its just a GUI, but Trinity has a built-in web server where you can restart your services from a web browser.



Edited 1 time(s). Last edit at 09/09/2009 02:39PM by MasterMind.
Re: How to add nginx system for a windows service?
October 16, 2009 05:18AM
Thanks for the information MasterMind, but I found a problem with using Nginx with FireDaemon. Nginx actually starts two processes and although FireDaemon can shut down the main process and start another, it does leave the other one running. This means that every time you restart the service (without restarting the whole computer) you're left with an orphaned process running for each restart (10 restarts, 10 orphaned nginx.exe's).

This is the same problem that I ran into when I tried to install Nginx using Microsoft's service tools (instsrv/srvany) and the Windows service process that Lighttpd uses. Each of them couldn't cope with the extra processes.

If there was a way to issue a command on restart / stop it would work, since it needs a "nginx -s stop" to properly stop the service.

If Igor comes across this, please could you let us know of any progress on Windows Service support. Or maybe someone with enough programming skills could knock together a service wrapper to execute the correct commands? It's the only thing stopping me (and probably others who are trapped in Windows environments) from jumping on the Nginx bandwagon.
Re: How to add nginx system for a windows service?
October 16, 2009 09:25AM
Hold the press! Problem solved!

I've posted details in the howto guide on properly running nginx as a service. Although I'd still love this feature to become part of nginx one day.

[url]http://forum.nginx.org/read.php?11,14292[/url]

My blog: http://misterdai.wordpress.com
Re: How to add nginx system for a windows service?
July 20, 2010 10:20PM
HI,netgod.try to do this free way

1.find and download instsrv.exe / srvany.exe , it's Windows Server 2003 Resource Kit Tools
2.run instsrv Nginx c:\nginx\srvany.exe .
3.create a reg file and double click to inport

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NGINX\Parameters]
"Application"="c:\\nginx\\nginx.exe"
"AppParameters"=""
"AppDirectory"="c:\\nginx\\"

then youcan at "services.msc" to start service now.
if want to stop nginx clearly
you can edit a bat such as

@echo off
echo Stopping nginx service...
net stop nginx
echo Kill nginx process...
taskkill /F /IM nginx.exe > nul

if you need help contarct me rainey2000@163.com
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 79
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready