Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to have a unix socket across a network? Is it possible to have multiple application servers running unicorn use that same shared socket?

The setup I'd like to achieve would look like:

 Unicorn     Unicorn

nginx config:

upstream github {
    server unix:/shared/unicorn.sock;

Unicorn config (x2)

listen '/shared/unicorn.sock'

I know it's possible to do something like:

upstream unicorns {

However I think this is not ideal, because you don't get the benefit of Unicorn doing its own load balancing and you have to specify the ip addresses ahead of time.

A few years ago GitHub blogged about their Unicorn setup, where I think they are describing a similar setup, but it's not clear how to achieve this.

share|improve this question
Isn't this what load balancers are for? – Tom O'Connor Feb 22 '13 at 23:27

Unix sockets only work within that system. A socket across the network is called a TCP connection. The way to do this is have Unicorn listen on a TCP socket and configure nginx to use them as upstreams (as you mentioned). Unicorn doesn't have distributed load balancing; you need nginx to do the load balancing.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.