Proxy Apache Load Balancers to a Unix Socket instead of a port
After having searched for quite a while, I came to the conclusion that using Apache2 + Unicorn via sockets is not possible.The farthest I got was using mod_fastcgi on the socket file that unicorn provides, but I got 403 Forbidden when trying to access the page.It seems that FastCGI requires a different protocol than the one Unicorn uses.Stick with the solution from Mark Kolesar if you have to use Unicorn with Apache. Be aware that you might run into problems (taken from http://rubyforge.org/pipermail/mongrel-unicorn/2011-July/001057.html):
Apache + Unicorn is still unsupported since (as far as anybody knows), it doesn't fully buffer responses and requests to completely isolate Unicorn from the harmful effects of slow clients.
ProxyRequests Off
ProxyPass /stylesheets/ !
ProxyPass /javascripts/ !
ProxyPass /images/ !
ProxyPass / http://example.com:8080/
ProxyPassReverse / http://example.com:8080/
Can't you do it using unixcat in between?Having the proxypass to localhost:somethingxinetd + unixcat installed/etc/xinetd.d/unicorn holding:
service livestatus{ type = UNLISTED port = someport socket_type = stream protocol = tcp wait = no cps = 100 3 instances = 500 per_source = 250 flags = NODELAY user = someone server = /usr/bin/unixcat server_args = /var/run/unicorn/mysocket only_from = 127.0.0.1 disable = no}