Quantcast
Channel: Nginx Forum - Other discussion
Viewing all articles
Browse latest Browse all 972

Re: nginx sometimes doesn't start

$
0
0
I have discovered that nginx returns a status code 0 when the init.d script fails to start.

If I force an error I see output in /var/log/nginx/error.log so I'm not sure why we're not getting any output there. Any clues?

Below I have the output of a fresh, default installation of nginx but something is already running on port 80 causing the startup to fail. However, as you can see the status code is 0.

ubuntu@graphite-tc2cj:~$ sudo service nginx start
Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
nginx.
ubuntu@graphite-tc2cj:~$ echo $?
0
ubuntu@graphite-tc2cj:~$ ps -aef | grep nginx
ubuntu 24422 23821 0 13:31 pts/0 00:00:00 grep --color=auto nginx

Viewing all articles
Browse latest Browse all 972