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

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;
    }


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容