# Can't setup Nginx reverse proxy for Kibana in Localhost

**URL:** <https://discuss.elastic.co/t/cant-setup-nginx-reverse-proxy-for-kibana-in-localhost/282176>\
**Category:** Kibana\
**Created:** [August 23, 2021, 12:13am UTC](https://discuss.elastic.co/t/cant-setup-nginx-reverse-proxy-for-kibana-in-localhost/282176 "2021-08-23T00:13:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amine\_Chichi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amine_chichi/32/78726_2.png) [@Amine\_Chichi](https://discuss.elastic.co/u/Amine_Chichi)\
**Post date:** [August 23, 2021, 12:13am UTC](https://discuss.elastic.co/t/cant-setup-nginx-reverse-proxy-for-kibana-in-localhost/282176/1 "2021-08-23T00:13:32Z")

</div>

I want to set up a reverse proxy to access kibana using a username and a password, so I followed this [tutorial](https://burnhamforensics.com/2019/02/06/how-to-install-and-configure-nginx-for-kibana/).

When I use the URL [http://elastic.local](http://elastic.local/) to access kibana the timeout occurs and nothing happen. But when I use 127.0.0.1:80 it accesses kibana without prompting any credentials. I want to access kibana using for example [http://elastic.local](http://elastic.local/) but can't make it work, I already googled a lot of solutions and many Nginx configuration files but none of them seems to work.

This is my configuration file named 'default' and located in etc/nginx/site-available and The symbolic link is already created and located under etc/nginx/site-enabled :

```auto
server {
    listen 80;

    server_name elastic.local;

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

```

PS : I already have ELK stack in my Ubuntu vm, and it's working fine and i can access kibana using [http://127.0.0.1:5601](http://127.0.0.1:5601/)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 23, 2021, 1:35am UTC](https://discuss.elastic.co/t/cant-setup-nginx-reverse-proxy-for-kibana-in-localhost/282176/2 "2021-08-23T01:35:20Z")

</div>

Welcome to our community! 😃

Is there a reason you aren't using the free Security in Elasticsearch and Kibana?

---

<div class="post-metadata">

**Author:** ![Amine\_Chichi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amine_chichi/32/78726_2.png) [@Amine\_Chichi](https://discuss.elastic.co/u/Amine_Chichi)\
**Post date:** [August 23, 2021, 2:09am UTC](https://discuss.elastic.co/t/cant-setup-nginx-reverse-proxy-for-kibana-in-localhost/282176/3 "2021-08-23T02:09:49Z")

</div>

@warkolm I am just playing around locally in my computer so it's not for production and i want to try the reverse proxy with nginx to set credentials for authentification

---

<div class="post-metadata">

**Author:** ![Amine\_Chichi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amine_chichi/32/78726_2.png) [@Amine\_Chichi](https://discuss.elastic.co/u/Amine_Chichi)\
**Post date:** [August 24, 2021, 6:57pm UTC](https://discuss.elastic.co/t/cant-setup-nginx-reverse-proxy-for-kibana-in-localhost/282176/4 "2021-08-24T18:57:59Z")

</div>

I managed to fix the problem what i did :

add a mapping between elastic.local and 127.0.0.1 in etc/hosts like this :

```auto
127.0.0.1 elastic.local

```

then restarting nginx server using :

```auto
sudo systemctl reload nginx.service

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 21, 2021, 6:58pm UTC](https://discuss.elastic.co/t/cant-setup-nginx-reverse-proxy-for-kibana-in-localhost/282176/5 "2021-09-21T18:58:00Z")

</div>

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