title: Exclude one directory from Nginx password authentication
body: <p>I have setup my Nginx server to have authentication for everything, but I want to exclude all the files under <code>/var/www/html/t/sms/plivo</code> for password authentication. I have tried using different paths but it always asks for a password when I try to access a file under <code>/var/www/html/t/sms/plivo</code> from my browser.</p>
  
  <p>Below is my <code>/etc/nginx/sites-available/default</code> file</p>
  
  <pre><code>server {
          listen 80 default_server;
          listen [::]:80 default_server;
  
          root /var/www/html;
  
          index index.php index.html index.htm index.nginx-debian.html;
  
          server_name _;
  
          auth_basic "Private Property";
          auth_basic_user_file /etc/nginx/.htpasswd;
  
          #no password for the plivo folder so we can recieve messages!
          location = /t/sms/plivo/ {
                  auth_basic off;
                  allow all; # Allow all to see content
          }
  
          location / {
                  try_files $uri $uri/ =404;
          }
  
          location ~ \.php$ {
                  include snippets/fastcgi-php.conf;
                  fastcgi_pass unix:/run/php/php7.0-fpm.sock;
          }
  
          location ~ /\.ht {
                  deny all;
          }
  }
  </code></pre>