Search code examples
nginxelasticsearchreverse-proxykibanakibana-4

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


Solution

  • 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