安裝nginx
yum -y install nginx修改nginx配置
vi /etc/nginx/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#添加upstream模塊
upstream kibana_web {
server 10.0.200.105:5601 weight=1 max_fails=2 fail_timeout=30s;
}
sendfile on;
keepalive_timeout 65;
server {
listen 5601;
server_name localhost;
location / {
auth_basic "The Kibana Monitor Center";
auth_basic_user_file /usr/share/nginx/html/.htpasswd;
root html;
index index.html index.htm;
proxy_set_header Host $host;
proxy_pass http://kibana_web;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
其中
auth_basic "The Kibana Monitor Center";
auth_basic_user_file /usr/share/nginx/html/.htpasswd; 配置權(quán)限
proxy_pass 做轉(zhuǎn)發(fā)用
3.添加用戶
htpasswd -c /usr/share/nginx/html/.htpasswd xxx
如果沒(méi)有htpasswd命令則
yum install httpd-tools
4.如果需要多個(gè)用戶則每個(gè)用戶配置一個(gè)端口即可