gforce91
gforce91

Reputation: 161

Kibana dashboard couldn't connect with Nginx

Hi i'm trying to use Nginx as a reverse proxy for accessing a Kibana 4 dashboard. The location of the dashboard is not available in the latest kibana but it can be accessed using a URL.

Kibana and Nginx are running both locally and installed on a windows machine installed in C:\

Kibana is running on localhost:5601. I installed NGinx and configured it to run on port 80. My config file of Nginx looks like this.

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    server {
        listen       80;
        server_name  127.0.0.1:5601;


        location / {
            root   html;
            index  index.html index.htm;
        }


        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

       location ~ {
            proxy_pass  http://127.0.0.1:5601;
            #proxy_redirect https://kibana/;
        }
}

But when i enter localhost in my browser i see,

"Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com.

Thank you for using nginx."

Kibana is working fine with : localhost:5601. Do i need to make any changes to the Kibana config file also? I want to access the kibana dashboard by localhost:80 through NGinx.

Thanks

Upvotes: 3

Views: 2717

Answers (3)

here is how you can proxy to kibana through nginx kibana and ES on a remote server with https using letencrypt

        server {
        listen [some_port] ssl http2;
        server_name [server_name];
        root /your/root/directoty;

        location /app {
        auth_basic "Restricted";
        auth_basic_user_file /etc/nginx/conf.d/yyyyyyyyy.passwd;
        proxy_pass http://example.com:5601;
       }


       location /bundles {
       proxy_pass  http://example.com:5601/bundles;
       }
       location /elasticsearch {
       proxy_pass [http://elasticsearch_server:9200;]
       }
       location /status {
       proxy_pass  http://example.com:5601/status;
       }
       location /api {
       proxy_pass  http://example.com:5601/api;
       }

       location /plugins {
       proxy_pass  http://example.com:5601/plugins;
       }


       location /ui {
       proxy_pass  http://example.com:5601/ui;
       }

       location /es_admin {
       proxy_pass  http://example.com:5601/es_admin;
       }

       location /built_assets {
         proxy_pass http://example.com:5601/built_assets;
       }

       location /node_modules {
         proxy_pass http://example.com:5601/node_modules;
       }

       location /translations {
         proxy_pass http://example.com:5601/translations;

       }

      location /internal {
        proxy_pass http://example.com:5601/internal;
      }   

     ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
     ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
     ssl_trusted_certificate /etc/letsencrypt/live/yourdomain.com/chain.pem;
     include snippets/ssl.conf;
     include snippets/letsencrypt.conf;

     access_log /var/log/nginx/xxxx.access.log;
     error_log /var/log/nginx/xxxxx.error.log;


     passenger_enabled on;
     passenger_min_instances 1;
     client_max_body_size 10m;

}

Upvotes: 0

mathakoot
mathakoot

Reputation: 1742

I have configured my nginx to reverse proxy the kibana-4 dashboard. The following nginx config does the job for me:

    server {
    listen 80;

    #You can add your fqdn, say example.com, if you want to in the next parameter
    server_name localhost;

    auth_basic off;

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

Upvotes: 0

user5126786
user5126786

Reputation:

Change "server_name 127.0.0.1:5601;" to "server_name localhost:80;"

Add this upstream above "server {" :

upstream kibana {
    server localhost:5601;
}

and then replace "location ~" with :

location /kibana/ {
    proxy_pass http://kibana/;
}

Use http://localhost/kibana to access Kibana

Upvotes: 2

Related Questions