502 Bad Gateway URGENT

Am new in dhis2, i have installed it when i start the tomcat in the browser i get 502 BAd gateway ginx/1.14.0 (Ubuntu)
dhis2 version 2.34.2

Are you following the documentation/guides to install DHIS2? If so what are you using?

Please check port 8005 because it says that it’s in use (underlined):

yes I have followed the documentation

Hi @dhis . As @Gassim is pointint out there is something wrong with your configuration. The screenshot you are providing seems to be something which is not coming from the official guide linked, please verify that you are following step by step. It seems that you have set up the port for shutting down Tomcat.

As a tip, if you would be under a Linux system (you can find a similar command on Windows) you could try running the command: netstat -tunapl | grep 8005 to see if another process is using that port.


hello @jaime.bosque @Gassim after running the above command I get this, does this mean that i should change port in server.xml file ?

Please follow the manual linked in the topic. I am not sure why did you include the shutdown directive in Tomcat. It seems the port is not being used by another service but your Tomcat is not properly set up.

so should i start again the installation process?

You should at least review your Tomcat part as it seems you didn’t follow it to the letter.

hello, check the grep command for 8080 port, lets see whats on it.This may be occupied too.Its seems that you are using ngnix, is ngnix properly configured?


1st point: is ngnix configuration file configured for redirecting to the dhis default port ie 8080.

if not perform the following in command:

sudo service ngnix stop

2nd : sudo ./startup.sh( restart the application) and check for dhis 2 application on 8080 in browser.

conclusion:after stopping ngnix if application works then the culprit is ngnix else we have to reverify other issues.

Fix ngnix configuration files.