Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Can't use sockets with rails #44

saiko-chriskun opened this Issue · 10 comments

4 participants

Chris Bolton Evan Phoenix Oleksandr Skrypnyk Kristijan Sedlak
Chris Bolton

rails s puma works fine, but I get the following when appending -b unix://tmp/sockets/puma.sock:

=> Booting Puma
=> Rails 3.2.2 application starting in development on http://unix://tmp/sockets/puma.sock:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Puma 0.9.4 starting...

  • Min threads: 0, max threads: 16
  • Listening on tcp://unix://tmp/sockets/puma.sock:3000 Exiting /usr/lib/ruby/gems/1.9.1/gems/puma-0.9.4/lib/puma/server.rb:103:in `initialize': getaddrinfo: Name or service not known (SocketError)
Chris Bolton

huh ok so I tried puma -b unix://tmp/sockets/puma.sock, but doesn't seem to be playing well with nginx, just gives me a bad gateway error. works fine if I don't use a socket and just use a custom port.

Chris Bolton

and my nginx setup works fine with unicorn's sockets.

Evan Phoenix

Was the first attempt calling puma via "rails server"? It looks like it got heavily confused because it's got a port number in there too.

I did just test it using nginx and it seems to work fine. What nginx configuration do you have it? Does the request show up in puma's log at all?

Oleksandr Skrypnyk

also tried to pair it with nginx, but all I've got is "Bad Gateway"
this configuration works well with Unicorn, but not with Puma


upstream puma {
  server unix://tmp/puma.sock fail_timeout=0;


bind "unix:///tmp/puma.sock"
pidfile "/tmp/"

running as:

~$ puma -C ./config/puma.rb
Puma 1.0.0 starting...
* Min threads: 0, max threads: 16
* Listening on unix:///tmp/puma.sock
Use Ctrl-C to stop
Evan Phoenix

I'm still unable to reproduce this issue. What is in

Oleksandr Skrypnyk

Just default Rails app

require ::File.expand_path('../config/environment',  __FILE__)
run TestApp::Application
Evan Phoenix

What version of nginx are you testing against? Does anything render?

Oleksandr Skrypnyk


Oops, sorry, my bad. nginx logs shows me: *1 connect() to unix://tmp/puma.sock failed (13: Permission denied) while connecting to upstream

chmod a+rw /tmp/puma.sock does the trick

Evan Phoenix

Oh interesting! So it was a permission problem. I'll investigate the proper way to set the perms of a unix socket.

Evan Phoenix evanphx closed this in 3dd7049
Kristijan Sedlak

Related to this #73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.