Normajean
Normajean

Reputation: 1275

How to stop nginx for windows?

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

Answers (10)

Jonah TZ
Jonah TZ

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

Roman Ilyasov
Roman Ilyasov

Reputation: 111

If you run via docker, you can type something like this in a separate window:

docker system prune

Upvotes: 0

TryCatchFinally
TryCatchFinally

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

MonDeveloper
MonDeveloper

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

Ziaullhaq Savanur
Ziaullhaq Savanur

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)

enter image description here

Upvotes: 0

Ormus
Ormus

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

Pravin Kumar
Pravin Kumar

Reputation: 371

This worked for me

wmic process where name='nginx.exe' delete

Upvotes: 5

Rohit Gaikwad
Rohit Gaikwad

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.

enter image description here

Upvotes: 22

Kumar
Kumar

Reputation: 4010

You can stop using quit

nginx.exe -s quit

Upvotes: 61

wasif
wasif

Reputation: 15498

Use @taskkill /f /im nginx.exe for this task.

Upvotes: 74

Related Questions