title: Certbot renew: nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
body: <p>Certbot and nginx versions:</p>
  
  <p>certbot installed using <a href="https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx" rel="noreferrer">certbot.eff.org</a> install guide.</p>
  
  <ul>
  <li>Certbot version: 0.22.2 </li>
  <li>Nginx version: 1.10.3</li>
  </ul>
  
  <p>Getting ssl certificates works fine:</p>
  
  <p><code>certbot --nginx</code></p>
  
  <p>But, in renewal of cerbot certificated</p>
  
  <p><code>certbot renew --dry-run</code></p>
  
  <p>nginx fails to start causing:</p>
  
  <p><code>nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
  </code></p>
  
  <p>I have tried changing post-hook and pre-hook in <code>/etc/letsencrypt/renewal/*com.conf/</code> </p>
  
  <ul>
  <li>commenting <code>installer=nginx</code></li>
  <li>changing authenticator to nginx and standalone</li>
  </ul>
  
  <p>Adding post and pre hooks in <code>/etc/letsencrypt/renewal-hooks/pre/</code> and <code>/etc/lestencrypt/renewal-hooks/post/</code> to stop and start nginx service. </p>
  
  <p>Seems nginx is not starting properly or isn't stop properly.
  after renewal completes nginx fails with (code=exited, status=1/FAILURE)</p>
  
  <p>Nginx error log show:</p>
  
  <p><a href="https://i.stack.imgur.com/9HPdL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9HPdL.png" alt="nginx log image"></a></p>
  
  <p>Error while certbot renew:
  <a href="https://i.stack.imgur.com/HMHXI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HMHXI.png" alt="Certbot error log in renewal"></a></p>