Reputation: 1275
I can't stop the nginx server on windows. I've tried: nginx -s stop
, taskkill /if nginx.exe
, and end process via task manager, yet it's still running!
Upvotes: 51
Views: 124651
Reputation: 21
I found a solution in from this site
Below is the part that save my day!
(also maybe) Be sure to run as admin.
Once I run the Powershell as Administrator,
TASKKILL /F /IM nginx.exe
terminate them all and they never return.
I also realize "nginx-FMWS50.exe" at the task-manager which I don't know why. What I did was I alter the same command to
TASKKILL /F /IM nginx_FMWS50.exe
BOOM! It works!
Upvotes: 2
Reputation: 111
If you run via docker, you can type something like this in a separate window:
docker system prune
Upvotes: 0
Reputation: 51
Make a windows shortcut somewhere and add the following in the target box:
C:\Windows\System32\cmd.exe /k "wmic process where name='nginx.exe' delete" && exit
Anytime you double clicked, nginx get shut down.
Upvotes: -1
Reputation: 356
Starting nginx with daemon off
will do the trick.
nginx is detauched from the console by default, independently if you run it directly using
./nginx.exe
or (as suggested by the guide) using
start ./nginx.exe
if you wanna stay coupled with the process who run the nginx (so it can pass the SIGTERM / CTRL+C to the nginx) you have to run this command:
nginx -g "daemon off;"
Upvotes: 11
Reputation: 2348
We can follow the steps motioned below to quit or reload the nginx if facing any issue like.
nginx: [error] CreateFile() "...logs/nginx.pid" failed
(2: The system cannot find the file specified)
Upvotes: 0
Reputation: 11
Make a .bat file in the nginx.exe folder with the command: nginx.exe -s quit
. Then make a shortcut to desktop or whereever needed.
Upvotes: 1
Reputation: 3914
One can toggle Nginx start stop in Windows using 2 command prompts. One for Nginx start and other for Nginx Stop.
If you stop Nginx from one command prompt then the Nginx process which was started from other prompt will automatically stop, Otherwise if you try to stop the Nginx process from where it started using ctrl+c then it will not stop even tough you close the command prompt, Unless you kill the nginx processes from TaskManager.
Upvotes: 22