利用nginx免登录kibana

698 阅读1分钟

需改nginx.conf

    server {
        listen       80;
        server_name  <Kibana_Server_Hostanme>;

        location / {
            proxy_pass http://<Kibana_Server_IP>:5600;

            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  Authorization "Basic <username:password>";
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

生成base64 账号密码

echo -n admin:123456 | base64

修改Kibana.yml

# headers, set this value to [] (an empty list).
elasticsearch.requestHeadersWhitelist: [authorization]

# Header names and values that are sent to Elasticsearch. Any custom headers cannot be overwritten
# by client-side headers, regardless of the elasticsearch.requestHeadersWhitelist configuration.
elasticsearch.customHeaders: {}

参考: www.woodscodeworld.com/blog/archiv…