Posts Tagged ‘nginx’

Getting 502 Bad Gateway with Passenger after cleaning gems

Thursday, February 25th, 2010

502 Bad Gateway

Recently I was updating some gems on my server. I did a gem update and a gem update –system. Everything seemed to be running smoothly. However a few minutes later I was checking my sites and I discovered that all of my Rack based sites were down and giving a 502 error.

The Background

In my short experience being my own webmaster, I’ve found that the 502 error code is the most unhelpful of error codes. It means that your app is not working. After a few times checking my error logs I noticed that the error that was bubbling up was “No such file or directory”. So I took this and searched through my apps looking for a file that might be missing

After a few hours of searching, restarting Nginx and reinstalling passenger, my apps and my gems, I took some time to think about the issue. I realized that all of my passenger apps were now suddenly failing, but my wordpress blog was still chugging along just fine. So I decided that the problem must be with Passenger.

The Culprit

After much digging around, I found that the Nginx config was still pointing to the Passenger version 2.2.9. A version I’d removed with gem clean many hours before. Once I updated this to version 2.2.10, which was the current version installed, everything started working again.

The Moral

If you update Passenger make sure that your webserver configuration is pointing to the new version.