10

Greeting, i have a server installed nginx streaming i did stop nginx and then did reload it, but it show me below error and was not start:

nginx -s stop 
nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No     such file or directory) 

i did below command and nothing:

sudo nginx 
nginx: [emerg] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory)

how i can resolve it? can anyone give me PID file content so i can creat it (Fake).

Thank you for your help.

6 Answers 6

9

I fix it by removing nginx.pid in /usr/local/var/run and then using brew services start nginx

Sign up to request clarification or add additional context in comments.

5 Comments

Im my case if I do so I then get an error saying nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory)
Did you fix this? Getting same issue now.
I am running with the same issue. In my case, the file nginx.pid does not exist in that location. so How to fix it in this case?
Try service nginx start
If you have installed your nginx using homebrew use the answer provided by stackoverflow.com/a/74949204/948241
4

I was using nginx installed by homebrew,

I deleted /opt/homebrew/var/run/nginx.pid (the location may vary depending on the version you are using)

sudo rm /opt/homebrew/var/run/nginx.pid

Then restarted the service

 brew services restart nginx

You may start it if it is not already running

brew services start nginx

Comments

4

I fixed this problem by run sudo nginx, After that you can run sudo nginx -s reload normaly.

Comments

3

your nginx does not start, start the nginx use nginx command

Comments

0

For linux users: 1- verify the location of nginx.pid from /etc/nginx/nginx.conf when you got the pid location delete it.

2- permission issue; try to chown user:user /run/nginx.pid then restart nginx.

Comments

0

Use this command to remove existing nginx cond.swp file

rm /etc/nginx/.nginx.conf.swp

Then reload nginx

nginx -t


sudo systemctl reload nginx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.