标签:Nginx

  • Nginx 使用 htpasswd 生成密码认证

    12-10-08 10:26 24617 0 技术

    安装 httpd-tools

    yum install -y httpd-tools
    

    htpasswd 命令需要先安装 httpd-tools

    修改 nginx.conf

    # xxx.cuiliang.com
    server {
        listen       80;
        server_name  xxx.cuiliang.com;
        auth_basic "密码提示语";
        auth_basic_user_file /usr/local/nginx/conf/htpasswd.users;
    
        location / {
            //...
        }
    }
    

    使用 htpasswd 生成密码

    htpasswd -b /usr/local/nginx/conf/htpasswd.users
    

    输入密码,再次确认密码,提示成功,OK!

    重启 nginx

    /usr/local/nginx/sbin/nginx -s reload
    

    重启生效

文章归档

文章日历

2024 年 03 月
27 28 29 30 31 01 02
03 04 05 06 07 08 09
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
01 02 03 04 05 06 07

文章标签

最新评论

友情链接