Welcome! Log In Create A New Profile

Advanced

Cannot stop nginx service on windows.

Posted by openemm 
Cannot stop nginx service on windows.
August 07, 2013 12:18AM
Hi,

I installed nginx on windows and starting nginx sucessfuly. But when i issued "nginx -s reload", i saw this line:

"nginx: [error] CreateFile() "c:\nginx-1.4.2/logs/nginx.pid" failed (2: The syste
m cannot find the file specified)"

And then I cannot stop nginx service ( i tried restart, shutdown windows, remove nginx folder ... ).

Any help will be greatly appreciated !
Re: Cannot stop nginx service on windows.
August 07, 2013 01:04PM
You have to kill the process with taskkill or pv.exe from prcview tools.
Re: Cannot stop nginx service on windows.
August 07, 2013 11:28PM
Thanks ipp2012,
I tried with tasklist and Task Manager but nginx disappear on those list and port 80 is still open.
Is this a bug of nginx on windows ?



Edited 1 time(s). Last edit at 08/07/2013 11:29PM by openemm.
Re: Cannot stop nginx service on windows.
August 08, 2013 01:18PM
I prefer to use pv.exe to kill the processes, always works, why port 80 remains open could be taskman specific as there are minimal 2 nginx processes.
I do consider this a nginx bug, but the windows version seems to be a development lower then low priority.
Re: Cannot stop nginx service on windows.
August 08, 2013 01:30PM
Simply via a cmd file:

rem Attempt to abort cleanly
nginx -s stop
rem stop the service that started it
net stop "NGinxWS"
rem Send a kill just in case
pv -kf nginx*
Re: Cannot stop nginx service on windows.
May 24, 2019 10:22PM
In my case
nginx -s stop
has no effect and there is no service called NGinxWS
pv is not recognised as an intern or extern command
Re: Cannot stop nginx service on windows.
May 25, 2019 04:37AM
TASKKILL /F /IM "nginx*"

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Cannot stop nginx service on windows.
March 20, 2020 05:28PM
Maybe too late, but I found a solution after some confusion on this Windows error:

According to the docs, 'you can run multiple times, but only one worker will do anything'.

When you start nginx, it creates a .PID file in the logs folder. When you quit, it deletes that file.

If you start more than once, it creates only one .PID file. When you quit the first time, that file gets deleted. Subsequent quits cannot find the file, thus the error.

The confusion (at least in my case) originates from a lack of messaging. When you use "start nginx", there is no confirmation message (e.g. "nginx is now running"). That's why I tried more commands, and ended up with too many processes.


(also maybe) Make sure your nginx directory, and all subdirectories are not Read-Only.

(also maybe) Be sure to run as admin.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
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