Kibana behind Nginx - Discover : Not Found


(Arik N) #1

Hi guys ,
Have a Kibana behind Nginx , Keep receiving this kind of messages from time to time - trying to understand how to debug it :S

Most of the times i receive data , but sometimes i receive the following error (usually when i first come into the system)

Any help?


(Jon Budzenski) #2

Are you able to share your nginx config? It sounds like a route isn't being proxied correctly.


(Arik N) #3

This is the config :

server
{
listen 443;
server_name elk.localhost;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/htpasswd.users;
location /
{
proxy_pass http://localhost:9200;
rewrite ^/es(.*) /$1 break;
}

location ~ ^/es.*$
{
    proxy_pass http://localhost:9200;
    rewrite ^/es(.*) /$1 break;
}

location /kibana 

{
proxy_pass http://127.0.0.1:5601/app/kibana#/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}

location /bundles
{
proxy_pass http://127.0.0.1:5601/bundles;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}

location /elasticsearch
{
proxy_pass http://127.0.0.1:5601/elasticsearch;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}

location /plugins
{
proxy_pass http://127.0.0.1:5601/plugins;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}

location /app/
{
proxy_pass http://127.0.0.1:5601/app/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}

location /rabbitmq/api/queues/ {
proxy_pass http://localhost:15672/api/queues/%2F/;
}
location /rabbitmq/api/exchanges/ {
proxy_pass http://localhost:15672/api/exchanges/%2F/;
}
location /rabbitmq/ {
proxy_pass http://localhost:15672/;
}

location ~ ^/kopf/.$ {
proxy_pass http://localhost:9200;
rewrite ^/kopf(.
) /_plugin/kopf/$1 break;
}

location ~ ^/hq.*$
{
    proxy_pass http://localhost:9200;
    rewrite ^/hq(.*) /_plugin/hq/$1 break;
}

error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 405 /error/405.html;
error_page 500 501 502 503 504 /error/5xx.html;

location ^~ /error/
{
    internal;
    root /var/www/default;
}

}


(Jon Budzenski) #4

Okay, some minor changes are needed I think:

location /kibana/
{
proxy_pass http://127.0.0.1:5601/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}

And then in config/kibana.yml make sure server.basePath is set to /kibana.


(Arik N) #5

Hey ,
With this config i am getting a 404 :S

--- Fix - My bad
Getting too many redirects error (Chrome)


(Jon Budzenski) #6

Hm, are you running shield? I'm coming up short otherwise, the only other thing i'd point out is the trailing slash for location /kibana/ is necessary.


(Arik N) #7

No Shield

This is Nginx--->Kibana


(Arik N) #8

Guys , any idea what im doing wrong ? :frowning:


(Tat Dat Pham) #9

I don't understand , why do you have many config in nginx? :frowning:
This is my config . I hope it will be useful for you .

server {
        listen 80;
        listen 443 ssl;
        server_name my.domain.com;
        #ssl on;
        ssl_certificate /etc/nginx/certificates/server.crt;
        ssl_certificate_key /etc/nginx/certificates/server.key;
        #ssl_dhparam /etc/nginx/conf.d/certificate/dhparams.pem;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;


        if ($server_port = 80) {
                rewrite ^ https://$host$request_uri permanent;
        }

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

        location / {
                proxy_pass http://10.1.x.x: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;

        }
    }

Of course, u can delete config SSL, and 10.1.x.x is my IP of ES cluster :).


(system) #10