
正文
ES,kibana通过nginx添加访问权限
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
一、安装nginxyum install epel-release -yyum install -y nginx
二、安装Apache Httpd 密码生成工具# 生成密码 yum install -y httpd-tools
$ mkdir -p /usr/local/nginx/conf/passwd
$ htpasswd -c -b /usr/local/nginx/conf/passwd/kibana.passwd zhanghao mima
三、配置Nginx反向代理#查看nginx配置文件位置
nginx -t#编辑nginx
vim /etc/nginx/nginx.conf
server {
listen 8080;
server_name 10.0.0.11;
auth_basic "Restricted Access";
auth_basic_user_file /usr/local/nginx/conf/passwd/kibana.passwd;
location / {
proxy_pass http://0.0.0.0: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;
}
}
四、最后开启防火墙#开启防火墙
systemctl start firewalld.service#添加端口
firewall-cmd --zone=public --add-port=9200/tcp --permanentfirewall-cmd --zone=public --add-port=8080/tcp --permanent#端口加入防火墙
firewall-cmd --add-port=5601/tcp
关闭SeLinux:
临时关闭(不用重启机器):setenforce 0
yum install epel-release -yyum install -y nginx
# 生成密码 yum install -y httpd-tools
$ mkdir -p /usr/local/nginx/conf/passwd
$ htpasswd -c -b /usr/local/nginx/conf/passwd/kibana.passwd zhanghao mima
三、配置Nginx反向代理#查看nginx配置文件位置
nginx -t#编辑nginx
vim /etc/nginx/nginx.conf
server {
listen 8080;
server_name 10.0.0.11;
auth_basic "Restricted Access";
auth_basic_user_file /usr/local/nginx/conf/passwd/kibana.passwd;
location / {
proxy_pass http://0.0.0.0: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;
}
}
四、最后开启防火墙#开启防火墙
systemctl start firewalld.service#添加端口
firewall-cmd --zone=public --add-port=9200/tcp --permanentfirewall-cmd --zone=public --add-port=8080/tcp --permanent#端口加入防火墙
firewall-cmd --add-port=5601/tcp
关闭SeLinux:
临时关闭(不用重启机器):setenforce 0
#查看nginx配置文件位置
nginx -t#编辑nginx
vim /etc/nginx/nginx.conf
server {
listen 8080;
server_name 10.0.0.11;
auth_basic "Restricted Access";
auth_basic_user_file /usr/local/nginx/conf/passwd/kibana.passwd;
location / {
proxy_pass http://0.0.0.0: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;
}
}
#开启防火墙
systemctl start firewalld.service#添加端口
firewall-cmd --zone=public --add-port=9200/tcp --permanentfirewall-cmd --zone=public --add-port=8080/tcp --permanent#端口加入防火墙firewall-cmd --add-port=5601/tcp
关闭SeLinux:
临时关闭(不用重启机器):setenforce 0








