Error 502 Bad Gateway on NGINX + rails + dokku

2019-05-14 11:12发布

问题:

I am receiving an Error 502 after deploying my Ruby on Rails app to a Dokku droplet on Digital Ocean. The app builds and deploys to Heroku just fine, as well as locally.

Checking the NGINX logs, I see the following:

2014/01/10 01:56:32 [error] 2376#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: <my.ip.add.ress>, server: app.campbellscoop.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:49153/", host: "app.campbellscoop.com"

What could be causing this error?

回答1:

You can check the errors by running dokku logs appname in the ssh.



回答2:

i think it's problem in restarting mod_passenger (nginx module for ruby)



回答3:

I had a similar issue after powering off my Dokku droplet on Digital Ocean. Easy fix was to ssh into the droplet and run:

dokku ps:rebuildall

Visit the app in the browser and all was well!