Bad Gateway (nginx)

Hi everyone !

I did a very simple installation (from digital ocean tutorial) of an ELK server on CentOS and i get this "bad gateway" error (after sending htpasswd credentials).

More information here :

Checking local 5601 port :

$ sudo netstat -laputen | grep 5601
tcp        0      0 127.0.0.1:5601          0.0.0.0:*               LISTEN      994        67656      12070/node
$ ps -eaf | grep 12070
kibana    12070      1  1 09:08 ?        00:01:23 /opt/kibana/bin/../node/bin/node /opt/kibana/bin/../src/cli

Verifying http accesibility :

$ curl -i localhost:5601
HTTP/1.1 200 OK
kbn-name: kibana
kbn-version: 4.4.2

Checking nginx configuration :

$ cat /etc/nginx/conf.d/kibana.conf
server {
    listen 80;

    server_name ELK;

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

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

Verifying hostname :

$ hostname
ELK

Checking kibana logs :

$ cat /var/log/kibana/kibana.stderr
*empty file*
$ cat /var/log/kibana/kibana.stdout
*no error message* 

Commentary :
I found something weird,
When i do :
$ systemctl start kibana
=> It start kibana service
$ service kibana start
=> it start another kibana service and i get two exact same services !!! (so here i use only one of this)

Someone have any idea about this ?
Cause i dont know where to find after all this stuff :frowning: !

Thanks for all and have a good day :slight_smile:

systemctl is the cli for Systemd whereas service is the cli for System V, they're different ways of managing subsystems in Unix. You'll likely want to choose one and stick with it.

Have you checked your NGINX logs? If you're able to curl localhost:5601 directly, it doesn't appear to be an issue with Kibana, so it's likely an issue with your nginx configuration.

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

A user has provided the solution in this other thread: Nginx Kibana: Bad gateway 502

Thank you @davideluque!