Can't setup Nginx reverse proxy for Kibana in Localhost

I want to set up a reverse proxy to access kibana using a username and a password, so I followed this tutorial.

When I use the URL http://elastic.local to access kibana the timeout occurs and nothing happen. But when I use 127.0.0.1:80 it accesses kibana without prompting any credentials. I want to access kibana using for example http://elastic.local but can't make it work, I already googled a lot of solutions and many Nginx configuration files but none of them seems to work.

This is my configuration file named 'default' and located in etc/nginx/site-available and The symbolic link is already created and located under etc/nginx/site-enabled :

server {
    listen 80;

    server_name elastic.local;

    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/htpasswd.users;

    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;        
    }

PS : I already have ELK stack in my Ubuntu vm, and it's working fine and i can access kibana using http://127.0.0.1:5601

Welcome to our community! :smiley:

Is there a reason you aren't using the free Security in Elasticsearch and Kibana?

@warkolm I am just playing around locally in my computer so it's not for production and i want to try the reverse proxy with nginx to set credentials for authentification

I managed to fix the problem what i did :

add a mapping between elastic.local and 127.0.0.1 in etc/hosts like this :

127.0.0.1   elastic.local

then restarting nginx server using :

sudo systemctl reload nginx.service

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.