Simple http authentication not working

António P. P. Almeida appa at perusio.net
Mon Jun 6 17:17:33 MSD 2011


On 5 Jun 2011 21h22 WEST, nginx-forum at nginx.us wrote:

> Below is my config. The folder /site/private is supposed to show the
> usual HTTP authentication box, but the php files from that folder
> just start downloading in clear text. What am I doing wrong? The
> path of the passwd file is correct.
>
> Thanks for any pointers! 
>
>
>
> location / {
>
> location
> ~.*\.(gif|jpg|png|ico|swf|rss|xml|htm|txt|js|css|gz|doc|xls|pdf)$ {
> expires max; try_files $uri @backend; log_not_found off; }
>
> location /site/private {
> auth_basic              "Restricted";
> auth_basic_user_file   
> /home/MYDOMAIN/.htpasswds/public_html/www/private/passwd;
> }

Right now the /site/private location is for handling static files
only. You've not defined any handler for scripts or any type of
upstream. So that's what you should get. Download the file when you
request it.

--- appa





More information about the nginx mailing list