HowTo: Troubleshoot "502 Bad Gateway" Errors

This error typically occurs with a nginx and supervisor [production setup] (https://kegbot.org/docs/server/production-server/) under three common scenarios.

Scenario One: Kegbot Server Won’t Load

You will see this error if:

  • nginx is running and supervisor is not running [AND/OR]
  • There is a misconfiguration between your supervisor and nginx configuration files

Please refer to the [production setup] (https://kegbot.org/docs/server/production-server/) documents, make any necessary changes to the configuration files, reload/restart supervisor, and restart nginx

Scenario Two: Modifying a Drink

When modifying a drink, Kegbot Server recalculates global statistics. Depending on the length of your drink history and the power of your server’s CPU, this can take a long time and may cause a timeout.

In kegbot-nginx.conf within location / declaration, add the following:

  • proxy_connect_timeout 300s;
  • proxy_read_timeout 300s;

In kegbot-supervisor.conf under [program:gunicorn]:

  • Append --timeout=300 to the end of the command line

Reload/Restart supervisor and restart nginx

If you still receive the 502 error, try increasing the timeout number.

Scenario Three: Triggering an E-mail Event

Kegbot Server can be configured, by user, to trigger e-mails when four events occur. Keg Start, Keg End, Session Start, Keg Volume Low. If your e-mail parameters are misconfigured, you may witness a 502 error on any of these events.

Be sure e-mail is set up properly

Alternative to E-mail (Workaround if e-mail is unconfigured)

  • Go to Account -> Notifications area and un-check ALL the notifications

And Remember…

We regularly update the Kegbot Server software, and your particular problem may have recently been fixed.

Kegbot Server Upgrade