# How to configure Kibana behind nginx balancer

**URL:** <https://discuss.elastic.co/t/how-to-configure-kibana-behind-nginx-balancer/304654>\
**Category:** Kibana\
**Created:** [May 13, 2022, 9:07am UTC](https://discuss.elastic.co/t/how-to-configure-kibana-behind-nginx-balancer/304654 "2022-05-13T09:07:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eduhernandezm](https://avatars.discourse-cdn.com/v4/letter/e/5f8ce5/32.png) [@eduhernandezm](https://discuss.elastic.co/u/eduhernandezm)\
**Post date:** [May 13, 2022, 9:07am UTC](https://discuss.elastic.co/t/how-to-configure-kibana-behind-nginx-balancer/304654/1 "2022-05-13T09:07:21Z")

</div>

Hi to everyone,

I have recently configured ELK in our enterprise environment. I have configured Kibana by default, without making changes, so to access Kibana, I do it by the configured host name and port:

[http://tfvs0755:5601/app/home](http://tfvs0755:5601/app/home)

I have reviewed the documentation, and I already know how to configure an nginx in the ELK server so that it goes through port 80 and not 5601, and avoid adding that port every time you want to access Kibana.

Now the only thing left for me to configure is the following. All the applications that we have mounted, in front of them, have an nginx balancer, which depending on the request you make, takes you to one application server or another. What I want to know is if Kibana can be configured to be accessible from the URL for example [www.mydomain.com/apps/kibana](http://www.mydomain.com/apps/kibana).  
In the nginx balancer, you would have a location to /apps/kibana and from there send the requests to the final kibana server.

How can I implement this solution? The version of ELK that I have installed is 8.0 on Ubuntu servers.

Thank you very much in advance.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [May 18, 2022, 4:11pm UTC](https://discuss.elastic.co/t/how-to-configure-kibana-behind-nginx-balancer/304654/2 "2022-05-18T16:11:46Z")

</div>

The `server.basePath` setting can do that: [Configure Kibana | Kibana Guide [master] | Elastic](https://www.elastic.co/guide/en/kibana/master/settings.html#server-basePath)

---

<div class="post-metadata">

**Author:** ![eduhernandezm](https://avatars.discourse-cdn.com/v4/letter/e/5f8ce5/32.png) [@eduhernandezm](https://discuss.elastic.co/u/eduhernandezm)\
**Post date:** [May 24, 2022, 9:37am UTC](https://discuss.elastic.co/t/how-to-configure-kibana-behind-nginx-balancer/304654/3 "2022-05-24T09:37:53Z")

</div>

Thank you very much for the reply.

I have followed the documentation that you have added, and configured everything that I think needs to be configured to be able to access it from a different URL.

These are my settings.

Kibana configuration

```auto
server.port: 5601

server.host: "tfvs0755.mydomain.net"

server.basePath: "/apps/dashboards/kibana"

server.rewriteBasePath: false

server.publicBaseUrl: "http://tfvs0755.mydomain.net:5601/apps/dashboards/kibana"

elasticsearch.hosts: ["http://tfvs0754.mydomain.net:9200"]

```

Nginx Configuration

```auto
server {
    #listen 80;
    listen 0.0.0.0:80;

    server_name tfvs0755.mydomain.net;

    access_log /var/log/nginx/access.log;

    #auth_basic "Restricted access";
    #auth_basic_user_file /etc/nginx/.kibana-user;

    location / {
        #proxy_pass http://127.0.0.1:5601;
        proxy_password http://10.140.220.163:5601;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header connection 'update';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_update;
    }
}

```

Now the problem is when I try to access the URL [http://tfvs0755.mydomain.net/apps/dashboards/kibana](http://tfvs0755.mydomain.net/apps/dashboards/kibana) it shows me an error on the screen:

{"statusCode":404,"error":"Not found","message":"Not found"}

What am I missing to finish configuring Kibana and access from this URL?

Thank you very much in advance

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [May 25, 2022, 5:47pm UTC](https://discuss.elastic.co/t/how-to-configure-kibana-behind-nginx-balancer/304654/4 "2022-05-25T17:47:49Z")

</div>

I think you are mixing up base path and "default route" -  
The base path is about prepending a path prefix to all requests Kibana is doing.  
The default route is the route that's opened by default if Kibana is opened without a deeplink (it's configured via advanced settings):

 ![Screenshot 2022-05-25 at 19.46.37](https://us1.discourse-cdn.com/elastic/original/3X/3/b/3bbe8b6f6e7ab735d844773554a2733f3154453f.png)

---

<div class="post-metadata">

**Author:** ![eduhernandezm](https://avatars.discourse-cdn.com/v4/letter/e/5f8ce5/32.png) [@eduhernandezm](https://discuss.elastic.co/u/eduhernandezm)\
**Post date:** [May 26, 2022, 11:02am UTC](https://discuss.elastic.co/t/how-to-configure-kibana-behind-nginx-balancer/304654/5 "2022-05-26T11:02:32Z")

</div>

Nice!

Now work fine!!

Thanks!!!!

---

<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:** [June 23, 2022, 11:02am UTC](https://discuss.elastic.co/t/how-to-configure-kibana-behind-nginx-balancer/304654/6 "2022-06-23T11:02:54Z")

</div>

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