1.添加一个单独的nginx配置文件,设置转发
# mkdir -pv /usr/local/nginx/conf/conf.d/ # vim /usr/local/nginx/conf/conf.d/kibana.conf server { listen 9090; server_name 123.456.789.012; #当前主机名 auth_basic "Restricted Access"; auth_basic_user_file /usr/local/nginx/conf/htpasswd.users; #登录验证 location / { proxy_pass http://127.0.0.1:5601; #转发到kibana 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; } }
2. 修改kibana配置文件kibana.yml
server.host: "127.0.0.1"
3. 配置登录验证
# yum install -y httpd-tools # htpasswd -bc /usr/local/nginx/conf/htpasswd.users 账号 密码 # cat /usr/local/nginx/conf/htpasswd.users
4.重新加载nginx配置
nginx -s reload
5.用浏览器直接访问9090端口输入账号密码进入