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.

Bobby Iliev
Site Moderator
Site Moderator badge
July 2, 2022

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



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel