Access Kibana and Elasticsearch externally with reverse proxy using NGINX

I was following the tutorial here.

When ssh’ing into the machine, i can access both Kibana and Elasticsearch via localhost mappings: If i run, form the SSH terminal: Curl -XGET localhost:5601/status , it returns the kibana site in all its html glory.

If i run, from the SSH terminal: Curl -XGET localhost:9200 , it returns the default JSON object from elasticsearch telling me that it is running.

This means that both services are running OK, and both services are in fact mapped to their respective ports and accessible over localhost.

I would like to be able to access Elasticsearch from my API, and Kibana from my droplets IP address.

I then set up an NGINX config to map any incoming call on :80 to :5601 , so that i can access Kibana on my droplets ip. This is my server config:

server {
    listen 80;

    server_name localhost;

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

Now, if i run Curl -XGET localhost:80/status i do get the kibana site as above in html written out.

But here is the problem, i still cant access it on mydropletip:5601/status OR mydropletip:80/status from outside localhost on the machine.

My UFW is set up to Nginx Full: To Action From

OpenSSH ALLOW Anywhere 9200 ALLOW My API’s IP Address Nginx Full ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) Nginx Full (v6) ALLOW Anywhere (v6)

Why is it that i still cant access neither Elasticsearch nor Kibana on my droplets IP address when it seems the network config is set up to allow this?


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