title: Letsencrypt Renewal + Nginx + owncloud config = failed because of regular expression
body: <p>I am running an owncloud-server with ngnix on Debian 8.
  I use a ssl-certificate for that domain from letsencrypt.</p>
  
  <p>Now i want to use an autorenewal-script, to run periodically and renew my certs. This works with all domains, except the owncloud.</p>
  
  <p>Actually there is one location block in the nginx-owncloud-config, that prevents letsencrypt from enter the subfolder <em>domain.org/.well-known/acme-challenge</em>:</p>
  
  <pre><code>location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
    deny all;
  }
  </code></pre>
  
  <p>By god, i am no expert in regular expressions and have no clue, how to solve this (and what this expression actually means).</p>
  
  <p>Below that Block i included a location block for the letsecrypt-renewal:</p>
  
  <pre><code># Letsencrypt auto-renewal
  location '/.well-known/acme-challenge' {
      default_type text/plain;
      root /var/www/;
      try_files $uri /$1;
  }
  </code></pre>
  
  <p>I think I tried something like:</p>
  
  <pre><code>location ~ ^/(?:\.(?!well-known/acme-challenge)|autotest|occ|issue|indie|db_|console) {
    deny all;
  }
  </code></pre>
  
  <p>...not knowing, if this would affect the expression.</p>
  
  <p>The only way for me is to comment out the "deny all". And it works. Actually i have in mind, to extend the renewal script to stop the server, change the owncloud-conf, restart the server again, fetch the new certs, stop the server again, change the owncloud-conf back und restart the server...</p>
  
  <p>But maybe its more simple. And i may learn something more about regex...</p>
  
  <p>Does anyone have a tip for me?</p>