authentication for kibana using nginx2 min read

Kibana authentication using nginx

Hello Techrunnr Readers, This document deals with enabling authentication for kibana using nginx webserver.

Kibana is opensource visulalization and analytics tools which works with Logstash and Elasticsearch.
By default, kibana doesn’t have any authentication by default.
Running kibana in the local machine without authentication doesn’t make security threat, but when you are setting up kibana publically it’s a major threat.
Here we are going to achieve this by using create an htaccess user and configuring the proxy pass for kibana.

This provides one more layer of security. This protects your analytics system from unauthorized access from hackers.


* Root access to install packages or sudo access
* Running Kibana

1. Install Nginx in the server.

apt-get install nginx //In Debian or Ubuntu

yum install nginx //In Centos or Redhat

2. Install htttp-tools

yum install http-tools // In Centos or Redhat

apt-get install apache2-utils // In Ubuntu or debian

3. Create Htuser for authentication

htpasswd -c /etc/nginx/.htpasswd username

4. Configuring Nginx

Here we are going to configure Nginx to act as a proxy, so it will directly authenticated user to “localhost:5601”

Open the Nginx configuration file with the command below:

vi /etc/nginx/nginx.conf

Find the “server” directive and change it like below:

server {
listen *:80;
server_name _;
location / {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;


5. Testing

Now you have completed kibana authentication configuration using NGINX.

Now goto browser and type IP or hostname, you can see the pop asking the username and password.

Don’t worry if you are using Apache web server. Here is the document for the same with apache web server.


Prabhin Prabharkaran Administrator
DevOps Engineer

He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!

follow me
We need your support!!
Other Amount:
Questions Answered
Articles Written
Overall Points

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

You may also like...

3 Responses

  1. Abhi says:

    [root@master nginx]# htpasswd -c /etc/nginx/ username
    htpasswd: cannot create file /etc/nginx/

    not sure, how ur command is working here, is it a correct command?

Leave a Reply