一、配置 kibana 只监听本机IP
root@es1:~
server.hosts: "127.0.0.1"
二、部署 Nginx 并添加配置文件
在 Kibana 服务器安装 Nginx 在Nginx添加反向代理配置文件
vim /apps/nginx/conf/nginx.conf
http {
include /usr/local/nginx/conf/conf.d/*.conf;
}
vim /apps/nginx/conf/conf.d/kibana.conf
upstream kibana_server {
server 127.0.0.1:5601 weight=1 max_fails=3 fail_timeout=60;
}
server {
listen 80;
server_name www.kibana1512.com;
location / {
proxy_pass http://kibana_server;
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;
}
}
/apps/nginx/sbin/nginx
三、实现认证登录 Kibana
apt -y install apache2-utils
htpasswd -bc /apps/nginx/conf/.htpasswd.users lck 123456
htpasswd -b /apps/nginx/conf/.htpasswd.users kibana 123456
vim /apps/nginx/conf/conf.d/kibana.conf
upstream kibana_server {
server 127.0.0.1:5601 weight=1 max_fails=3 fail_timeout=60;
}
server {
listen 80;
server_name www.kibana1512.com;
auth_basic "Restricted Access";
auth_basic_user_file /apps/nginx/conf/.htpasswd.users;
location / {
proxy_pass http://kibana_server;
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;
}
}
/apps/nginx/sbin/nginx -s reload
|