AFAIK Apache doesn't support listening on a socket ... its a web server. If performance is your reason for doing this, the difference between sockets/tcp is negligible for most web servers - as the bottleneck is whatever app is running anyway (PHP/Perl etc.)
–
Ben Lessani - SonassiOct 2 '12 at 21:04

I assume you have too many connections which stack up so you want to move proxy from tcp stack to socket. I would suggest you to try disable keepalive; also it might help to enable TCP_TW_REUSE (net.ipv4.tcp_tw_reuse)
–
Hrvoje ŠpoljarOct 8 '12 at 11:16

2 Answers
2

While you most likely could set Nginx to proxy redirect to a socket using unix:/path/to/socket syntax, Apache Listen directive only accepts IPv4 or IPv6, so as far as I know you can't get Apache to listen on an unix socket.

It would be trivial to script a proxy to map the unix socket to a network socket - but you lose any performance benefit. OTOH the lo interface doesn't have nearly the same performance constraints as a physical interface, even if it does slow start, as long as you've got big congestion windows then it should run at nearly the same speed as a unix socket.
–
symcbeanOct 5 '12 at 11:49

Socket will still have edge on small requests where latency is essential.
–
c2h5ohOct 8 '12 at 16:38

What about the webserver? Apache in this case.
–
Quintin ParSep 28 '12 at 19:10

Possible to give an answer with a full flow?
–
Quintin ParSep 28 '12 at 19:10

1

In a brief search, I couldn't find anything in the documentation that indicated that Apache is capable of listening on a unix domain socket.
–
Clint MillerSep 28 '12 at 19:58

1

There is no need to define upstream to proxy requests to a unix socket, proxy_pass http://unix:/path/to/socket:; would do the trick as well, see nginx.org/r/proxy_pass.
–
Maxim DouninOct 3 '12 at 15:50