# \[ 4.3.0 \] how to configure your nginx balancer and apache reverse proxy

**URL:** <https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351>\
**Category:** Kibana\
**Created:** [December 16, 2015, 12:09pm UTC](https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351 "2015-12-16T12:09:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yodog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yodog/32/4822_2.png) [@yodog](https://discuss.elastic.co/u/yodog)\
**Post date:** [December 16, 2015, 12:09pm UTC](https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351/1 "2015-12-16T12:09:54Z")

</div>

problem solved. solution below the question.

* * *

could someone please help me reconfigure my nginx balancer?

i have 3 elk nodes behind a UDP/TCP balancer (round-robin).

```
                   |----------------|
                   | |
                   | elk-balancer |
                   | |
                   | 80,514,9200 |
                   |----------------|
                           |
        ---------------------------------------
        | | |
|----------------| |----------------| |----------------|
| | | | | |
| elk-node-01 | | elk-node-02 | | elk-node-03 |
| | | | | |
|----------------| |----------------| |----------------|

```

since i updated kibana to 4.3.0 , i cant balance kibana web requests anymore.

nginx just hangs there, waiting for for the node to respond... forever...

GET [http://elk-balancer/kibana](http://elk-balancer/kibana)

`/var/log/nginx/access-80.log`

> 10.11.12.32 - - [16/Dec/2015:09:41:13 -0200] "GET /kibana/ HTTP/1.1" 200 158 "-" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36"
> 
> 10.11.12.32 - - [16/Dec/2015:09:41:16 -0200] "POST /kibana/elasticsearch/\_mget?timeout=0&ignore\_unavailable=true&preference=1450266075817 HTTP/1.1" 200 183 "[http://10.20.30.160/kibana/app/kibana](http://10.20.30.160/kibana/app/kibana)" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36"
> 
> 10.11.12.32 - - [16/Dec/2015:09:41:16 -0200] "POST /kibana/elasticsearch/.kibana/index-pattern/\_search?fields= HTTP/1.1" 403 103 "[http://10.20.30.160/kibana/app/kibana](http://10.20.30.160/kibana/app/kibana)" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36"

but elasticsearch, logstash, pen and rsyslog are working fine.

---

<div class="post-metadata">

**Author:** ![yodog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yodog/32/4822_2.png) [@yodog](https://discuss.elastic.co/u/yodog)\
**Post date:** [December 17, 2015, 12:50pm UTC](https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351/2 "2015-12-17T12:50:34Z")

</div>

ok. got it.

this is what you need for a fully functional proxy / load balancer answering on [http://my-balancer/kibana/](http://my-balancer/kibana/)

#Balancer

**nginx**

`/etc/nginx/conf.d/elastic-80.server.conf`

```
upstream web {

    server elk-node-01;
    server elk-node-02;
    server elk-node-03;

    keepalive 5;
}

server {

    listen 80;

    location / {

        proxy_pass http://web;
        proxy_http_version 1.1;
        proxy_set_header Connection "Keep-Alive";
        proxy_set_header Proxy-Connection "Keep-Alive";
    }

    access_log /var/log/nginx/access-80.log;
    error_log /var/log/nginx/error-80.log;
}

```

#Nodes

**kibana**

`/var/www/kibana/config/kibana.yml`

```
# If you are running kibana behind a proxy, and want to mount it at a path,
# specify that path here. The basePath can't end in a slash.
server.basePath: "/kibana"

```

**apache**

`/etc/apache2/sites-available/15-default.conf`

```
<Location /kibana/>
    ProxyPass http://localhost:5601/
    ProxyPassReverse http://localhost:5601/
</Location>
```

---

<div class="post-metadata">

**Author:** ![biswajit86](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@biswajit86](https://discuss.elastic.co/u/biswajit86)\
**Post date:** [February 11, 2016, 2:33am UTC](https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351/3 "2016-02-11T02:33:54Z")

</div>

@yodog,

I tried following your instructions to setup my apache proxy but it is not working for me.

- Do I need to change any configs to account for the fact that kibana is now rendered at /app/kibana# ? (for ex my try to get kibana mounted at /kibana1/ redirects to /kibana1/app/kibana/ which returns a json with a 404 not found error)
- I have a bunch of kibana clusters which I want to back behind an alias in apache proxy. How do I do that ?

---

<div class="post-metadata">

**Author:** ![yodog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yodog/32/4822_2.png) [@yodog](https://discuss.elastic.co/u/yodog)\
**Post date:** [February 15, 2016, 4:52pm UTC](https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351/4 "2016-02-15T16:52:40Z")

</div>

that is all you need to change.

copy-paste the errors that you are getting, so we can take a look.

---

<div class="post-metadata">

**Author:** ![Diego\_Corradini](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@Diego\_Corradini](https://discuss.elastic.co/u/Diego_Corradini)\
**Post date:** [February 19, 2016, 9:22am UTC](https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351/5 "2016-02-19T09:22:28Z")

</div>

@yodog unfortunately It s not working for me.

I m using just nginx as web-server with the following configuration:

```
server {
    listen 80;
    listen [::]:80;
    server_name _;

    location / {
        uwsgi_pass django;
        include /opt/das/webapp/uwsgi_params;
        proxy_http_version 1.1;
    }

    location /kibana/ {
        rewrite /kibana/(.*) /$1 break;
        proxy_pass http://localhost:5601/;
}

```

The root and elasticsearch are working fine, the problem is with kibana which is redirected to [http://host/kibana/app/kibana](http://host/kibana/app/kibana)

---

<div class="post-metadata">

**Author:** ![yodog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yodog/32/4822_2.png) [@yodog](https://discuss.elastic.co/u/yodog)\
**Post date:** [February 23, 2016, 2:47pm UTC](https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351/6 "2016-02-23T14:47:18Z")

</div>

well...  
your config is totally different from the config that i posted.

i could help you if you had tried my config and failed.

---

<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:** [July 6, 2017, 2:01pm UTC](https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351/7 "2017-07-06T14:01:22Z")

</div>


