# Kibana - Nginx 502 Bad Gateway

**URL:** <https://discuss.elastic.co/t/kibana-nginx-502-bad-gateway/304709>\
**Category:** Kibana\
**Created:** [May 13, 2022, 6:29pm UTC](https://discuss.elastic.co/t/kibana-nginx-502-bad-gateway/304709 "2022-05-13T18:29:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![uklipse](https://avatars.discourse-cdn.com/v4/letter/u/cdc98d/32.png) [@uklipse](https://discuss.elastic.co/u/uklipse)\
**Post date:** [May 13, 2022, 6:29pm UTC](https://discuss.elastic.co/t/kibana-nginx-502-bad-gateway/304709/1 "2022-05-13T18:29:11Z")

</div>

I tried logging into Kibana and was greeted with a 502 Bad Gateway error. Our setup is a single server hosting elastic, logstash and kibana. On the server, I got a 302 redirect when running curl -i [http://localhost:5601](http://localhost:5601). When I changed curl -i to curl -iL to follow the redirect, I get the 200 OK message followed by the html.

The /var/log/nginx/kibana.error.log shows "[error] 1862#1862: \*815 connect() failed (111: Connection refused) while connecting to upstream" when trying from my system. I'm thinking something is up with nginx but have very little experience with it. Any suggestions to troubleshoot next?

---

<div class="post-metadata">

**Author:** ![uklipse](https://avatars.discourse-cdn.com/v4/letter/u/cdc98d/32.png) [@uklipse](https://discuss.elastic.co/u/uklipse)\
**Post date:** [May 13, 2022, 7:54pm UTC](https://discuss.elastic.co/t/kibana-nginx-502-bad-gateway/304709/2 "2022-05-13T19:54:33Z")

</div>

FIXED - The config file in /etc/nginx/sites-enabled/default was set to fqdn:5601 and changing it to localhost:5601 allowed the page to load. Not sure why it stopped working other than sometimes ELK likes localhost or fqdn or 127.0.0.1 and now it liked localhost.

---

<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 10, 2022, 7:55pm UTC](https://discuss.elastic.co/t/kibana-nginx-502-bad-gateway/304709/3 "2022-06-10T19:55:21Z")

</div>

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