server { listen 80; server_name www.example.com example.com; root /var/www/www.example.com/web; [...] location /test { auth_basic "Restricted"; auth_basic_user_file /var/www/www.example.com/.htpasswd; } [...] }