I had a strange problem earlier when deploying some changes in my Ruby on Rails app to an Nginx and Passenger stack. Google didn't help in my particular instance so I thought I'd put it up here in case anyone else ever suffers the same fate.
I was getting an Nginx 502 Bad Gateway error in my browser, and in my Nginx log file was:
2013/01/02 12:36:01 [error] 4019#0: *17786109 upstream prematurely closed connection while reading response header from upstream, client: **.**.**.**, server: manage.****.net, request: "GET /schools/10/plugins HTTP/1.1", upstream: "passenger:unix:/passenger_helper_server:", host: "manage.****.net"
Couldn't get my head around it for ages, then when trying to start Rails console on the application server, it became clear (with an error message that was actually sensible) that I had used the new Ruby hash syntax (symbol to object) in an observer, and my server was running Ruby 1.8.7! Moronic mistake and the fix was obviously to change it to the hash-rocket syntax, but why it caused Rails to implode I don't really know.