tags:

views:

49

answers:

1

Hello nginxers,

I have a folder F with several html files

  • A.html
  • B.html
  • C.html
  • index.html

They are auto generated python doc by sphinx.

I would like my url /foo to show B.html unrestricted but everything else should prompt for a password using auth_basic "Restricted".

So far i tried the following without success

location /foo {
    index B.html;
    alias   /home/novagile/www/doc_novasniff/doc/_build/html;
    auth_basic            "off";


}
location /foo {
    index index.html;
    alias   /home/novagile/www/doc_novasniff/doc/_build/html;
    auth_basic            "Restricted";
    auth_basic_user_file  /etc/nginx/htpass;

}

An help is welcome,

Greg

A: 

try this.

location ~ ^/foo/?$ {
    root /home/novagile/www/doc_novasniff/doc/_build/html;
    rewrite ^ /B.html break;
}
location ~ ^/foo/(.+)$ {
    alias  /home/novagile/www/doc_novasniff/doc/_build/html/$1;
    index  index.html;
    auth_basic "Restricted";
    auth_basic_user_file /etc/nginx/htpass;
}
KITORA Naoki