Report this

What is the reason for this report?

Installed ELk Log Stack gives 502 Bad Gateway

Posted on July 26, 2015

Hi,

I just installed Elk Log Stack with one click install on Ubuntu 14.04,

When i logged into the ip with the user password as described in: https://www.digitalocean.com/community/tutorials/how-to-use-the-digitalocean-elk-stack-one-click-application

Then I get a Nginx 502 Bad Gateway, i have following in the /var/log/nginx/error.log

2015/07/26 08:57:40 [error] 934#0: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 37.24.151.202, server: , request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:5601/”, host: “46.101.233.103” 2015/07/26 08:57:40 [error] 934#0: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 37.24.151.202, server: , request: “GET /favicon.ico HTTP/1.1”, upstream: “http://127.0.0.1:5601/favicon.ico”, host: “46.101.233.103”, referrer: “http://46.101.233.103/

I’m new to the log stack and sort of new to nginx, and i expected the one click install to work out of the box… What can i do to fix this ?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Check your kibana.yml file.

the server.host should be the same as what in the proxy_pass

nginx config proxy_pass http://localhost:5601;

kibana.yml server.host: “localhost”

after restart it should fix the bad gateway issue.

CentOS users might need to run this command:

$ setsebool httpd_can_network_connect on -P

This is because the webserver is not allowed to make new network connections, so it can not proxy the request.

If you got 502 error from Nginx ; Try This:

    server {
      listen 80;
      server_name kibana-server;

      location / {
        auth_basic "secret";
        auth_basic_user_file /nginx/passwd;
        proxy_pass http://localhost:5601;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }

      location /app/kibana {
        auth_basic "secret";
        auth_basic_user_file /nginx/passwd;
        proxy_pass http://localhost:5601/app/kibana;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
    }

Attetion to the location path!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.