# Kibana sometimes refuses connection behind nginx

**URL:** <https://discuss.elastic.co/t/kibana-sometimes-refuses-connection-behind-nginx/29755>\
**Category:** Kibana\
**Created:** [September 22, 2015, 7:32am UTC](https://discuss.elastic.co/t/kibana-sometimes-refuses-connection-behind-nginx/29755 "2015-09-22T07:32:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![das\_J](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@das\_J](https://discuss.elastic.co/u/das_J)\
**Post date:** [September 22, 2015, 7:32am UTC](https://discuss.elastic.co/t/kibana-sometimes-refuses-connection-behind-nginx/29755/1 "2015-09-22T07:32:52Z")

</div>

I am running Kibana 4.1.2 behind nginx 1.8.0. I am also running Icinga 2 which checks if Kibana is running. In my nginx error log there is (for each check) this error:

```auto
2015/09/22 09:22:38 [error] 10626#0: *186124 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: kibana.example.com, request: "GET / HTTP/1.1", upstream: "http://[::1]:5601/", host: "kibana.example.com"

```

My nginx config (mostly consisting of stuff I found on the internet when I tried to fix Kibana):

```auto
upstream kibana {
    server localhost:5601 fail_timeout=5;
    keepalive 64;
}

server {
    listen 443;
    listen [::]:443;

    server_name kibana.example.com;
    location / {
        proxy_pass http://kibana;
        proxy_set_header Connection "Keep-Alive";
        proxy_set_header Proxy-Connection "Keep-Alive";
        proxy_set_header Connection "";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_pass_header Access-Control-Allow-Origin;
        proxy_pass_header Access-Control-Allow-Methods;
        proxy_hide_header Access-Control-Allow-Headers;
        add_header Access-Control-Allow-Headers 'X-Requested-With, Content-Type';
        add_header Access-Control-Allow-Credentials true;
    }
}

```

Proxying other applications does not give these errors, so I suspect Kibana (or my configuration) to be the problem.

What can I do in this case?

---

<div class="post-metadata">

**Author:** ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)\
**Post date:** [September 26, 2015, 5:44am UTC](https://discuss.elastic.co/t/kibana-sometimes-refuses-connection-behind-nginx/29755/2 "2015-09-26T05:44:31Z")

</div>

> [@das\_J](#):
>
> I am also running Kibana 2 which checks if Kibana is running.

I'm not sure what is meant by this.

---

<div class="post-metadata">

**Author:** ![das\_J](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@das\_J](https://discuss.elastic.co/u/das_J)\
**Post date:** [September 28, 2015, 2:04pm UTC](https://discuss.elastic.co/t/kibana-sometimes-refuses-connection-behind-nginx/29755/3 "2015-09-28T14:04:23Z")

</div>

Just fixed it. It was supposed to mean Icinga 2.

---

<div class="post-metadata">

**Author:** ![billkoch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/billkoch/32/6356_2.png) [@billkoch](https://discuss.elastic.co/u/billkoch)\
**Post date:** [December 3, 2015, 7:31pm UTC](https://discuss.elastic.co/t/kibana-sometimes-refuses-connection-behind-nginx/29755/4 "2015-12-03T19:31:25Z")

</div>

Could you provide details of the fix? I'm hitting a similar issue. Thanks!

---

<div class="post-metadata">

**Author:** ![das\_J](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@das\_J](https://discuss.elastic.co/u/das_J)\
**Post date:** [December 4, 2015, 10:18pm UTC](https://discuss.elastic.co/t/kibana-sometimes-refuses-connection-behind-nginx/29755/5 "2015-12-04T22:18:51Z")

</div>

With "fixed" i meant my message. Haven't fixed Kibana. Abandoned it.

---

<div class="post-metadata">

**Author:** ![billkoch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/billkoch/32/6356_2.png) [@billkoch](https://discuss.elastic.co/u/billkoch)\
**Post date:** [December 5, 2015, 12:07am UTC](https://discuss.elastic.co/t/kibana-sometimes-refuses-connection-behind-nginx/29755/6 "2015-12-05T00:07:49Z")

</div>

Ah, I see -- my apologies for the misread. Thanks for following up.

---

<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:07pm UTC](https://discuss.elastic.co/t/kibana-sometimes-refuses-connection-behind-nginx/29755/7 "2017-07-06T14:07:27Z")

</div>


