Nginx on ES/Kibana machine


(Kofi) #1

Hi guys,

I've been trying every combination to make this work and after many hours, I've come here to post my config for anyone in the future because it was hard to find any documentation about it.

I'm setting up nginx on a machine with both kibana and ES on it (I know for prod that's not great). And it's difficult to get nginx to properly redirect both ES and kibana when they are on the same machine. But alas, I figured it out with the help of this post

kib.yml
server.basePath:"/kibana"

nginx

server {
    listen 80;

    #server_name http://yourwebsitename.com;

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

    location ~ ^/kibana/(.*)$ {
        rewrite /kibana/(.*) /$1 break;
        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;
    }
    location / {
        proxy_pass http://localhost:9200;
        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;
    }
}

(system) #2

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