Restarting nginx: nginxnginx: [appearance] bind () to 0.0.0.0:80 failed (98: address already in use)

When I try to restart nginx with sudo / etc / init.d / nginx reboot, I get a message from the topic.

I found that the reason is because the script does not know how to stop the deamon, because the pid file (/var/run/nginx.pid) is not created at startup.

I have two installations on two different servers ... one was compiled from the source, and the other with a phusion passenger.

I tried this command:

start-stop-daemon --start --quiet --pidfile /var/run/nginx.pid --exec /usr/sbin/nginx -- -c /etc/nginx/nginx.conf

a pid file is created on both machines and one, but not on the other - the paths are slightly different on this computer (but I don’t think it matters):

start-stop-daemon --start --quiet --pidfile /var/run/nginx.pid --exec /opt/nginx/sbin/nginx -- -c /opt/nginx/conf/nginx.conf

The process starts and pid is not written ...

I'm on Debian ...

Any suggestions?

+5
source share
3 answers

, nginx.conf:

pid        /var/run/nginx.pid;

, -, .

+5

, fuser

$sudo fuser -k 80/tcp

, 80. .

: https://goo.gl/6oc0xD

0
$ sudo nginx -t 

to see all processes, sometimes you do not have full permission

0
source

All Articles