z0nek

关于我

[root@mysql116 nginx]# htpasswd -c /usr/local/nginx/passwd.db vincent

New password:

Re-type new password:

看一下生成的密码文件

[root@mysql116 nginx]# cat passwd.dbvincent:$apr1$tKPCytS9$k5szk5XsBk1CktQNDyNmu1

然后在nginx的配置中添加两条:

location /{

proxy_pass https://127.0.0.1:5601;

auth_basic "secure";

auth_basic_user_file /usr/local/nginx/passwd.db;

}

重新加载配置文件

[root@mysql116 nginx]#./sbin/nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/

nginx.conf test is successful

[root@mysql116 nginx]#./sbin/nginx -s reload


标签:linux

评论
© z0nek | Powered by LOFTER