/etc/nginx/conf.d/default.conf
location /logio {
        proxy_pass http://192.168.1.2:28778/;
        auth_basic "secret";
        auth_basic_user_file /etc/nginx/passwd.db;
    }
语法:     auth_basic string | off;
默认值:     auth_basic off;
配置段:     http, server, location, limit_except
默认表示不开启认证,后面如果跟上字符,这些字符会在弹窗中显示。
语法:     auth_basic_user_file file;
默认值:     —
配置段:     http, server, location, limit_except

htpasswd -c /etc/nginx/passwd.db admin   用户密码文件
chmod 400 /etc/nginx/passwd.db
chown nginx.nginx /etc/nginx/passwd.db

/etc/init.d/nginx reload

results matching ""

    No results matching ""