CoderSathi
  • Tutorial
    • Java Tutorial
    • Swing Tutorial
    • JDBC Tutorial
    • Java String Tutorial
    • Servlet and JSP Tutorial
  • Mongo DB
  • AWS
  • DevOps
  • Linux
  • Git
Home > How to > Run Kibana behind Nginx proxy with basic authentication

Run Kibana behind Nginx proxy with basic authentication

Learn the concepts, implementation details, and practical steps with a clean developer-focused walkthrough.

Yuba Raj Kalathoki
By Yuba Raj Kalathoki
Published: September 25, 2020 · 2 min read · 0 Comments
Share: X in 🔗
Kibana

Steps to run Kibana behind Nginx Proxy

To run Kibana behind Nginx proxy with basic authentication is really let’s go through the steps below

  1. Install Nginx
  2. Enable basic authentication
  3. Route Nginx to Kibana

Install nginx

sudo apt-get install nginx

To enable basic authentication, we need to create a username and password. We are using the apache2-utils package. Which helps us to create a user. Install it if you don’t have already.

Install apache2-utils

sudo apt-get install apache2-utils

Now, create a user with following command:

 htpasswd -c /etc/nginx/.htpasswd admin

It will ask you to enter a new password and confirm the password for the user admin. You will see a similar kid of message in your terminal.

root@ip-10-1-0-199:~# htpasswd -c /etc/nginx/.htpasswd admin
New password:
Re-type new password:
Adding password for user admin

Now, the user creation is complete.

Now we need to configure nginx for kibana. Hence,

Edit the file like below:

Note: If you want to keep the backup of the original config file. Then you can execute the following command before editing the config file for Kibana. You can simply execute the following command.

sudo mv /etc/nginx/sites-available/default /etc/nginx/sites-available/original_backup_default

Edit config file

sudo vim /etc/nginx/sites-available/default

And paste the following code

server {
    listen 80;
    server_name localhost;
    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/.htpasswd;
    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;
    }
}

Save it.

You can test whether the configuration is correct or not. With following command:

nginx -t

If the configuration is correct then you will see the message like:

root@ip-10-1-0-199:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Reload the nginx service

sudo service nginx reload

Conclusion

We are successfully configured the nginx for Kibana.

Related Posts:

  • Setting Up an EC2 Instance with Amazon CloudFront…
  • Route traffic from AWS Application Load Balancer to…
  • How to Write User Stories and Acceptance Criteria: A…
  • How to Solve “systemctl command not found” Error: A…
  • MySQL Commands for Developers
  • Packages in Java: A Guide to Modular, Maintainable Code
Tags:devopslinuxnginxubuntu
Was this article helpful?
← Previous ArticleHow to uninstall Nginx completely in Linux Ubuntu?
Next Article →How to Login/SSH to AWS EC2 linux instance?

Leave a Comment Cancel reply

You must be logged in to post a comment.

Recent Posts

  • How to Use AWS CloudFront Signed URLs in Spring Boot?
  • How to Fix SSH Agent Forwarding on macOS: The Ultimate Guide for Developers
  • How to Read AWS Secrets Manager in Spring Boot (Step-by-Step)
  • How to Fix “Public Key Retrieval is not allowed” MySQL JDBC Error
  • Complete Guide to JaCoCo: How to Measure Java Code Coverage Accurately
CoderSathi

Your go-to resource for Java, Spring Boot, Microservices, AWS, and modern development tutorials.

Quick Links

  • About
  • Contact

Popular Topics

  • Java
  • Spring Boot
  • AWS
  • DevOps
  • MongoDB
  • Linux
  • Git
  • How to
© 2026 CoderSathi. All rights reserved. Privacy Policy · Sitemap