Ok, solved this, just in case anyone needs the solution, here it is. [code] location /admin { auth_basic "Restricted"; auth_basic_user_file /path/to/.htpasswd; location ~ \.php$ { include fastcgi.conf; fastcgi_pass my-backend; } } [/code] Posted at Nginx Forum: http://forum.nginx.org/read.php?2,131021,131044#msg-131044