# API 502 Bad Gateway

**URL:** <https://forum.mattermost.com/t/api-502-bad-gateway/891>\
**Category:** Troubleshooting\
**Created:** [February 14, 2016, 1:45am UTC](https://forum.mattermost.com/t/api-502-bad-gateway/891 "2016-02-14T01:45:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thileepan](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@Thileepan](https://forum.mattermost.com/u/Thileepan)\
**Post date:** [February 14, 2016, 1:45am UTC](https://forum.mattermost.com/t/api-502-bad-gateway/891/1 "2016-02-14T01:45:51Z")

</div>

Hi All,

More often I am getting API 502 bad gateway issue. Even my web console UI also not loading. Everytime I need to restart the mattermost service. What will be the issue?

Note: Service is running in ubunut 14.x with nginx.

Thanks  
Thileepan

---

<div class="post-metadata">

**Author:** ![crspeller](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/crspeller/32/2605_2.png) [@crspeller](https://forum.mattermost.com/u/crspeller)\
**Post date:** [February 25, 2016, 7:08pm UTC](https://forum.mattermost.com/t/api-502-bad-gateway/891/2 "2016-02-25T19:08:21Z")

</div>

Hi Thileepan,

Sounds like the Mattermost server is not starting correctly. Can you post your Mattermost server logs here? It would give me a better idea of what is going on. There should be a logs/mattermost.log in the directory you installed mattermost.

---

<div class="post-metadata">

**Author:** ![Thileepan](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@Thileepan](https://forum.mattermost.com/u/Thileepan)\
**Post date:** [February 25, 2016, 8:23pm UTC](https://forum.mattermost.com/t/api-502-bad-gateway/891/3 "2016-02-25T20:23:59Z")

</div>

Hi there,

Really thanks for your reply. I will send you the log shortly. But before that, I want to let you know that the error goes off when I try to access the API one more time. If the server is hit after a long time then the first try fails always and successive attempts get success.

Thanks  
Thileepan

---

<div class="post-metadata">

**Author:** ![Thileepan](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@Thileepan](https://forum.mattermost.com/u/Thileepan)\
**Post date:** [February 25, 2016, 10:40pm UTC](https://forum.mattermost.com/t/api-502-bad-gateway/891/4 "2016-02-25T22:40:35Z")

</div>

Actually, I didn’t see anything weird in the log file today as you mentioned.

Here the log for today:

[2016/02/25 06:06:38 UTC] [EROR] /webdav/: code=404 ip=192.99.144.140  
[2016/02/25 09:37:40 UTC] [EROR] /manager/html: code=404 ip=222.186.21.112  
[2016/02/25 15:00:59 UTC] [EROR] /manager/html: code=404 ip=189.57.228.200  
[2016/02/25 17:34:31 UTC] [EROR] /w00tw00t.at.blackhats.romanian.anti-sec:): code=404 ip=162.213.152.36  
[2016/02/25 17:34:31 UTC] [EROR] /phpMyAdmin/scripts/setup.php: code=404 ip=162.213.152.36  
[2016/02/25 17:34:31 UTC] [EROR] /phpmyadmin/scripts/setup.php: code=404 ip=162.213.152.36  
[2016/02/25 17:34:31 UTC] [EROR] /pma/scripts/setup.php: code=404 ip=162.213.152.36  
[2016/02/25 17:34:32 UTC] [EROR] /myadmin/scripts/setup.php: code=404 ip=162.213.152.36  
[2016/02/25 17:34:32 UTC] [EROR] /MyAdmin/scripts/setup.php: code=404 ip=162.213.152.36  
[2016/02/25 20:29:17 UTC] [EROR] /freepbx/admin/CHANGES: code=404 ip=104.192.0.18  
[2016/02/25 20:45:49 UTC] [EROR] /freepbx/admin/CHANGES: code=404 ip=104.192.0.18

My guess is the proxy server (nginx) lost connection with the server. Please let me know if something I have to check from my side.

Thanks  
Thileepan
