title: Nginx regex to exclude certain paths
body: <p>I am trying to exclude some paths in my nginx proxypass and want everything else to go to my proxypass.</p>
  
  <p>i.e I dont want to give proxy_pass to any url which starts with 'tiny' or 'static', but want everythign else to go to my proxypass location.</p>
  
  <p>and I am using following regex to achieve this:</p>
  
  <pre><code>~ ^((?!tiny|static).)*$
  </code></pre>
  
  <p>But I always get 404 error.
  If I navigate to following url in browser</p>
  
  <pre><code>localhost:8080/xyz
  </code></pre>
  
  <p>I want it to go to </p>
  
  <pre><code>localhost:8000/api/tiny/records/xyz
  </code></pre>
  
  <p>Can someone please help me in pointing out what is the issue ?</p>
  
  <p>Here is my full nginx conf file:-</p>
  
  <pre><code>server {
          listen       8080;
          server_name  localhost;
          location   ~ ^((?!tiny|static).)*$ {
              proxy_pass  http://localhost:8000/api/tiny/records/$1;
          }
          location   / {
              proxy_pass  http://localhost:8000;
          }
          error_page   500 502 503 504  /50x.html;
          location = /50x.html {
              root   html;
          }
      }
  
  </code></pre>
  
  <p>Thanks a lot.</p>