I tried to run a "nginx -c /etc/nginx/nginx.conf" but I got:

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()
[Exit 1]

Then I run a

 fuser -k 80/tcp ; service nginx restart.

I tried again with "nginx -c /etc/nginx/nginx.conf" but still the same error "[emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)"

Why is this happening?

up vote 3 down vote accepted

This is not how you reload nginx.
What you are trying is starting nginx again, -c just specifies the configuration file it should use.
Use service nginx reload or /etc/init.d/nginx reload to reload it.

  • Ops I thought it was the command to reload the config "silently" – MultiformeIngegno Dec 30 '12 at 20:57
  • I'd look into signals for config reload, they're rather typical. – gparent Dec 30 '12 at 21:08
  • 1
    SIGHUP is the silent reload signal for NGINX (on the master process). but using 'reload' attribute to the init.d script is easier for most. – CloudWeavers Dec 30 '12 at 21:32
  • Does reload imply worker process to change id? – MultiformeIngegno Dec 30 '12 at 23:52
  • 1
    Depends on the actual init script, but usually it is also just sending SIGHUP. For more information on what happens, see here: nginx.org/en/docs/control.html – faker Dec 31 '12 at 0:05

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.