title: Is it possible to allow nginx to start if the specified certificate/keys files are absent?
body: <p>I have following situation: I have an nginx instance serving a few websites like this:</p>
  <pre><code>server {
    listen 443 ssl;
    server_name website1.com;
    root /var/www/website1;
    ssl_certificate /etc/ssl/certs/website1.crt;
    ssl_certificate_key /etc/ssl/private/website1.key;
    ...
  }
  
  server {
    listen 443 ssl;
    server_name website2.com;
    root /var/www/website2;
    ssl_certificate /etc/ssl/certs/website2.crt;
    ssl_certificate_key /etc/ssl/private/website2.key;
    ...
  }
  
  server {
    listen 80 default_server;
    root /var/www/acme;
  
    # Allow files to be served for the use of acme certification only
    try_files $uri @redirect;
  
    location @redirect {
      return 301 https://$host$request_uri;
    }
  }
  </code></pre>
  <p>Now I ended with the chicken and the egg problem where:</p>
  <ol>
  <li>Without certificates nginx will crash</li>
  <li>To generate certificates I need to serve <code>/var/www/acme</code> files</li>
  <li>To serve those file I need nginx running</li>
  </ol>
  <p>I know I can manually remove uncertified vhosts from configuration, generate the certificates and then reenable it, but this will be a pain to automate in ansible.</p>
  <p>Also I cannot disable nginx and use standalone certbot instance, since I need to be able to add websites without interfering with already existing websites.</p>
  <p>In apache I was able to do this:</p>
  <pre><code>&lt;IfFile /etc/ssl/certs/$name.crt&gt;
    &lt;VirtualHost *:443&gt;
    ...
    &lt;/VirtualHost&gt;
  &lt;/IfFile&gt;
  </code></pre>
  <p>Is there a similar feature in nginx, or at least a way to prevent errors in one of the vhosts from killing the entire server?</p>