I have tried many suggestions online but nothing has worked. I have unicorn and nginx working to deploy a ruby on rails app on a CentOS 6.5 server. It has worked before b
I faced a 502 Bad Gateway issue just yesterday on my Ubuntu 12.10 and nginx and unicorn. These type of errors are too generic so the best I can do is help you find more details about underlying error. In my case, I was able to determine the cause by viewing the end of my unicorn log file.
tail -n 100 /home/unicorn/log/unicorn.log
Your unicorn log may be located somewhere else, I'm on a Digital Ocean server with the rails app setup. But I do think you will find the cause of the error you are receiving in your unicorn log file. If not, check your nginx error log.
In my case, I had conflicted gem versions between system gems and my app (unicorn is not running under bundle exec, on my todo) but your issue may be something else. The logs will help you figure out the cause of the 502 Bad Gateway.