Question

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

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there,

In case that you want to be able to access mydropletip:5601/status you would need to allow that port with:

ufw allow 5601

Regarding the reverse proxy at mydropletip:80/status this should indeed work, do you get any errors when you try to access it? I could suggest checking your Nginx logs for some more information:

tail -100 /var/log/nginx/error.log

Regards,

Bobby