使用 Nginx 反向代理 Kibana 并配置访问基本认证

时间:2021-08-20
本文章向大家介绍使用 Nginx 反向代理 Kibana 并配置访问基本认证,主要包括使用 Nginx 反向代理 Kibana 并配置访问基本认证使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

安装nginx

apt-get install nginx

使用openssl创建一个管理员用户,例如“admin”,可以访问Kibana Web界面

echo "admin:`openssl passwd -apr1`" | tee -a /etc/nginx/conf.d/htpasswd.users

配置nginx

vim /etc/nginx/conf.d/default.conf
server {
    listen 80;
    server_name example.com;
    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/conf.d/htpasswd.users;
    location / {
        proxy_pass http://localhost:5601;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

检查配置并重启nginx

nginx -t
systemctl restart nginx
作者:Varden
本文内容如有雷同,请联系作者!
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

原文地址:https://www.cnblogs.com/varden/p/15164875.html