nginx中增加auth basic配置

nginx中增加auth basic配置,设置访问ES集群的用户名密码:
server {

        listen       9200;



        location / {

            auth_basic           "closed site";

            auth_basic_user\file /etc/nginx/htpasswd;

            proxy_pass http://172.16.0.39:9200;

        }

    }


上述配置将用于访问ES集群的用户名和加密后的密码放置在/etc/nginx中的htpasswd文件中,文件内容为:
elastic:Xcp0L3LGmWIlw

访问命令:curl 121.201.61.70:9200 -u elastic:123

猜你喜欢

转载自blog.csdn.net/wuxing164/article/details/80980127