title: Restarting nginx: nginxnginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
body: <p>When I try to restart nginx with sudo /etc/init.d/nginx restart I get the message from the subject.</p>
  
  <p>I discovered that the reason is most likely that the script doesn't know how to stop the deamon because the pid file (/var/run/nginx.pid) is not created on start.</p>
  
  <p>I have two installations on two different servers... one was compiled from source and the other came with phusion passenger.</p>
  
  <p>I tried this command:</p>
  
  <pre><code>start-stop-daemon --start --quiet --pidfile /var/run/nginx.pid --exec /usr/sbin/nginx -- -c /etc/nginx/nginx.conf
  </code></pre>
  
  <p>on both machines and on one the pid file is created and on the other it is not - on that machine the paths are a bit different (but I don't think this is relevant):</p>
  
  <pre><code>start-stop-daemon --start --quiet --pidfile /var/run/nginx.pid --exec /opt/nginx/sbin/nginx -- -c /opt/nginx/conf/nginx.conf
  </code></pre>
  
  <p>The process starts and pid is not written...</p>
  
  <p>I'm on Debian... </p>
  
  <p>Any suggestions?</p>