Server access error: 502 Bad Gateway error message (nginx)

Hi Dear community,
I am a newly administrator of a DHIS2 project and web users kept getting this message error when trying to connect to the server:


502 Bad Gateway
nginx
Some times after this error, the access become available again.
Can you please help me understand and some potential solutions??

Hi @FTOGOLA

Welcome to the community! The error Server access error: 502 Bad Gateway error message (nginx) is a generic one which can be caused for several reasons; therefore, to understand what’s going on, you’ll need to check the logs please.

Would you share the logs for nginx and tomcat (without sensitive / authentication info)?

  • Nginx logs: `/var/log/nginx` (on linux)
  • Tomcat: Catalina.out
1 Like

Generally it means nginx try to speak to the java process of tomcat but can’t.
If you got it working a first time, I assume it’s the java process that is dead or stopped.

You probably need to look at Catalina.out or dhis2 logs (in the dhis directory where dhis.conf is)

Do you have nginx and dhis2 on the same machine ?

  • Check if tomcat is running
  • Check the nginx config if points to the correct address/ports
  • Check the firewall accept incoming connections on ports 80/443

Try to draw a diagram like this and test the “lines” crossing boxes with curl

Note if your machine restart regularly, verify tomcat is configured to restart after boot.

image

2 Likes

Hi AL Gassim, Thank you for your Feedback. I don’t have access to the server. I have reached out to BAO to deal with this. I will give you feedback if that works.

1 Like