Welling Guzman's homepage

Disable nginx basic_auth for one location

If you protected your website with nginx basic_auth, and want to disable it for just one (or maybe some specific locations), you can use basic_auth off for that location and the authorization won't be required.

Example:

server {
  auth_basic "Restricted content";
  auth_basic_user_file /etc/nginx/.htpasswd;

  location /public/ {
    auth_basic off;
  }
}