zoukankan      html  css  js  c++  java
  • 使用nginx代理kibana并设置身份验证

    1、在es-sever上安装nginx

    # wget http://nginx.org/download/nginx-1.8.1.tar.gz 
    # tar xvf nginx-1.8.1.tar.gz
    # yum install -y gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel
    # useradd nginx
    # cd nginx-1.8.1/
    
    # ./configure  --prefix=/usr/local/nginx  --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/var/log/nginx/error.log  --http-log-path=/var/log/nginx/access.log  --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock  --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre 
    # make 
    # make install 
    
    # mkdir -pv /var/tmp/nginx/client/
    # /usr/local/nginx/sbin/nginx
    # tail -f /var/log/nginx/access.log

    2、添加一个单独的nginx配置文件,设置转发

    # mkdir -pv /usr/local/nginx/conf/conf.d/
    # vim /usr/local/nginx/conf/conf.d/kibana.conf
    server {
        listen 80;
        server_name 192.168.135.136;    #当前主机名
        auth_basic "Restricted Access";
        auth_basic_user_file /usr/local/nginx/conf/htpasswd.users;      #登录验证
        location / {
        proxy_pass http://192.168.135.136: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;
        }
    }

    3、修改nginx主配置文件导入配置

    # vim /usr/local/nginx/conf/nginx.conf 
    include /usr/local/nginx/conf/conf.d/*.conf;

    4、配置登录验证

    # yum install -y httpd-tools
    # htpasswd -bc /usr/local/nginx/conf/htpasswd.users admin admin
    # cat /usr/local/nginx/conf/htpasswd.users

    5、重启nginx

    # /usr/local/nginx/sbin/nginx -t
    # /usr/local/nginx/sbin/nginx -s reload

    6、用浏览器直接访问80端口

    http://192.168.135.136/
  • 相关阅读:
    Java开源框架推荐(全)
    Java性能提示(全)
    国外程序员整理的 C++ 资源大全 (zt)
    技术杂记之:在阿里云centos7上部署JDK MYSQL TOMCAT
    技术杂记之:vi使用入门
    Java全栈程序员之09:IDEA+GitHub
    SpringCloud无废话入门05:Spring Cloud Gateway路由、filter、熔断
    SpringCloud无废话入门04:Hystrix熔断器及监控
    SpringCloud无废话入门03:Feign声明式服务调用
    SpringCloud无废话入门02:Ribbon负载均衡
  • 原文地址:https://www.cnblogs.com/a-du/p/7724044.html
Copyright © 2011-2022 走看看