Question

Rails/Nginx/Capistrano/Puma: (111: Connection refused) while connecting to upstream

I followed this guide on Digital Ocean to set up my server with my Rails project. I’m still fairly new to Puma and Nginx, so I don’t have the confidence to touch anything in the configuration files.

I’m getting this error:

2016/06/06 20:14:02 [error] 907#0: *1 connect() to unix:///home/user/apps/appname/shared/tmp/sockets/appname-puma.sock failed (111: Connection refused) while connecting to upstream, client: 50.100.162.19, server: , request: "GET / HTTP/1.1", upstream: "http://unix:///home/user/apps/appname/shared/tmp/sockets/appname-puma.sock:/", host: "appname.com"

(here it is with manually added newlines for your convenience)

2016/06/06 20:14:02 [error] 907#0: *1 connect() to
unix:///home/user/apps/appname/shared/tmp/sockets/appname-puma.sock failed
(111: Connection refused) while connecting to upstream, client: 
50.100.162.19, server: , request: "GET / HTTP/1.1", upstream: 
"http://unix:///home/user/apps/appname/shared/tmp/sockets/appname-
puma.sock:/", host: "appname.com"

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Oh my god, I can’t believe I didn’t reply to this. I obviously found a solution since then.

Sometimes I need to reboot the droplet with sudo reboot, other times (usually after I commit), I have to restart the server. I use Capistrano, so I just had to do cap production deploy:restart.

To solve this issue I had to navigate to my “app”. Then I performed a “rails s” command which starts the Puma server, if it is in your* Rails app Gemfile “gem puma*”. I had connection errors until I cleared up the Local puma errors. Also if you have a database in your Rails app run “rake db:migrate” or if you have a seed run “rake db:seed”