Install and Configure Nginx for Elasticsearch, Logstash, Kibana

Install and Configure Nginx for Elasticsearch, Logstash, Kibana
This tutorial will go over how to install and configure Nginx for ELK stack.

Install Nginx

Adding HTTPS support.

sudo apt-get install -y nginx apache2-utils

Configure Nginx

sudo mkdir /etc/nginx/sites-avaiable
sudo /etc/nginx/sites-avaiable/touch kibana
sudo mousepad /etc/nginx/sites-available/kibana &

paste this:
server {
    listen 80;
    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/.kibana-user;
    location / {
        proxy_pass http://localhost: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;

Create basic auth file and user

sudo htpasswd -c /etc/nginx/.kibana-user admin

Activate the kibana virtual host

sudo ln -s /etc/nginx/sites-available/kibana /etc/nginx/sites-enabled/

Test the nginx configuration

sudo nginx -t

Restart Nginx by running:

sudo service nginx restart

Restart the Kibana service with the command:

sudo service kibana restart


  • Nginx, stylized as NGINX, nginx or NginX, is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Igor Sysoev and publicly released in 2004.
  • Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.
  • Logstash is a free and open server-side data processing pipeline that ingests data from a multitude of sources, transforms it, and then sends it to your favorite "stash."
  • Kibana is a data visualization dashboard for Elasticsearch. It provides visualization capabilities on top of the content indexed on an Elasticsearch cluster. Users can create bar, line and scatter plots, or pie charts and maps on top of large volumes of data.