We have a VPS with some PHP websites hosted on our Ubuntu 12.04 LTS servers using NGINX. In a Joomla 3 site, when uninstalling an extension that errors out, the page shows an NGINX error page with a 502 Bad Gateway rather than showing the error message within Joomla like it does in Apache.

The error log message produces an obvious error as to why the site broke and easy to fix from the extension itself (db connectivity error from PostgreSQL).

2014/05/06 16:26:12 [error] 17702#0: *26 upstream sent invalid status "0 Error connecting to PGSQL database." while reading response header from upstream, client: xx.xx.xxx.xx, server: sub.example.com, request: "POST /administrator/index.php?option=com_installer&view=manage HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "sub.example.com", referrer: "http://sub.example.com/administrator/index.php?option=com_installer&view=manage"

As the error points out, it's a PostgreSQL database connection error.

In my research, I found that 502 Bad Gateway is usually the result of an incorrectly set configuration file. This is what leads me to think that when something errors out in Joomla, the error isn't handled properly and display the 502 error page.

What I need to know is: why does the site error out as a 502 Bag Gateway error in NGINX + PHP-FPM when the DB connectivity error occurs? Is this an incorrect configuration in NGINX and/or PHP-FPM or is this how this usually handles errors?

Image of how Joomla w/apache handles the same error:

Joomla w/apache postgres connection error

Note: I've used the Joomla configuration from http://docs.joomla.org/Nginx


It's probably related to an invalid status header I had the same issue when an exception is thrown without a http status code as exception code it will fail: Hopefully it's merged soon ;) you can patch it manually for the time being: https://github.com/joomla/joomla-cms/compare/staging...Mech7:fix-nginx-status?expand=1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.