DevOps

nginx代理kibana配置账号密码访问

2021-11-11  本文已影响0人  王宣成

es由于x-pack收费, 用nginx代理来做认证,安全组禁用kibana、elasticsearch端口,开放80通过域名访问

编辑es配置文件 elasticsearch.yml 关闭 es x-pack

cluster.name: "docker-cluster"
network.host: 0.0.0.0

## X-Pack settings
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack.html

# 试用版
#xpack.license.self_generated.type: trial

# 基础版
xpack.license.self_generated.type: basic 
# false不启用
xpack.security.enabled: false   
xpack.monitoring.collection.enabled: false

安装httpd插件

yum -y install httpd-tools

添加账号密码

#账号admin 密码123456  先新建文件
httpasswd -b /usr/local/nginx/db/passwd.db  admin  123456

nginx配置

    location ~ (/|/app|/api|/internal|/translations|/bundles|/ui|/built_assets/|/elasticsearch|/spaces/enter|44040|plugins|node_modules|gif|jpg|png|js|css) {

        auth_basic "secret";
        auth_basic_user_file /usr/local/nginx/db/passwd.db;

        proxy_pass          http://127.0.0.1:5601;
        proxy_set_header    Host $host;
        proxy_set_header    X-Real-IP $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto $scheme;
        proxy_set_header    X-Forwarded-Host $http_host;
        proxy_set_header    Authorization "";
        proxy_hide_header   Authorization;
    }


上一篇下一篇

猜你喜欢

热点阅读