Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从文件夹nginx&;提供文件的权限;auth_basic_Nginx - Fatal编程技术网

从文件夹nginx&;提供文件的权限;auth_basic

从文件夹nginx&;提供文件的权限;auth_basic,nginx,Nginx,我有一个文件夹F和几个html文件 A.html B.html C.html index.html 它们是sphinx自动生成的python文档 我希望我的url/foo显示B.html不受限制,但其他所有内容都应使用auth_basic“Restricted”提示输入密码 到目前为止,我尝试了以下方法,但没有成功 location /foo { index B.html; alias /home/novagile/www/doc_novasniff/doc/_build

我有一个文件夹F和几个html文件

  • A.html
  • B.html
  • C.html
  • index.html
它们是sphinx自动生成的python文档

我希望我的url/foo显示B.html不受限制,但其他所有内容都应使用auth_basic“Restricted”提示输入密码

到目前为止,我尝试了以下方法,但没有成功

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;

}
欢迎帮助

格雷格试试这个

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;
}