ELK in Eleven ---- by nginx proxy login authentication and to achieve kibana

First, by nginx proxy login authentication and to achieve kibana

1, install nginx

1, compile and install nginx Service

[root@elk-1 nginx-1.14.2]# tar xvf nginx-1.14.2.tar.gz 
[root@elk-1 nginx-1.14.2]# cd nginx-1.14.2/
[root@elk-1 nginx-1.14.2]# ./configure --prefix=/apps/nginx
[root@elk-1 nginx-1.14.2]# make -j 2 && make install

2, modify nginx configuration file, define a document certified kibana.conf

[the root-Elk @ ~. 1] # Vim /apps/nginx/conf/nginx.conf 
the include /apps/nginx/conf.d/*.conf; # last row in braces defines the include 
} 
[@ Elk-the root. 1 ~] # mkdir /apps/nginx/conf.d # create a directory

3, create a domain name in the /apps/nginx/conf.d directory access kibana.conf profile

[root@elk-1 conf.d]# cat  kibana.conf 
upstream kibana_server {
        server  127.0.0.1:5601 weight=1 max_fails=3  fail_timeout=60;
}

server {
        listen 80;
        server_name kibana-net.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;
        }
}

4, domain name resolution in the hosts file

[root@elk-1 conf.d]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.7.100 kibana-net.com

Also need to modify the host file in the machine: C: \ Windows \ System32 \ the Drivers \ etc

2, began to nginx encryption and authentication

1, the installation package httpd-tools centos system inside a htpasswd command, the user can create and encryption settings

# yum install httpd-tools -y

2, create a user name, and set up a secret

[root @ elk-1 conf.d] # htpasswd -bc /apps/nginx/conf/htpasswd.users liu 123456 # for the first time to create the directory can add the -c option, the second time to create a second account, you can not then add the -c option, the account is liu, the password is 123456 
adding password for the User liu 
[root @ Elk-1 conf.d] # htpasswd -b /apps/nginx/conf/htpasswd.users mA 123456 
adding password for the User mA

3, start the service nginx

# /apps/nginx/sbin/nginx

3, access kibana domain name on the web

1, the domain name at this time you need to enter a password to access  

 

 

 

 

Guess you like

Origin www.cnblogs.com/struggle-1216/p/12503092.html