server {
    listen       80;
    server_name  domain.com;

    auth_basic "登录";
    auth_basic_user_file /path/auth.password;

    location ^~ /test/ {
        auth_basic off;
        allow all;
    }

    auth_basic "登录";
    auth_basic_user_file /path/auth.password;

上面这段配置指定了/test/开头的链接不进行auth_basic验证,里面需要配置auth_basic offallow all

Last modification:April 22nd, 2020 at 04:27 pm