# Could nginx support the socket backend server(in different machines)?

**URL:** <https://www.ruby-forum.com/t/could-nginx-support-the-socket-backend-server-in-different-machines/178733>\
**Category:** NGINX\
**Created:** [November 10, 2009, 11:25am UTC](https://www.ruby-forum.com/t/could-nginx-support-the-socket-backend-server-in-different-machines/178733 "2009-11-10T11:25:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wangbin579](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/bc79bd/32.png) [@wangbin579](https://www.ruby-forum.com/u/wangbin579)\
**Post date:** [November 10, 2009, 11:25am UTC](https://www.ruby-forum.com/t/could-nginx-support-the-socket-backend-server-in-different-machines/178733/1 "2009-11-10T11:25:55Z")

</div>

for several reasons,the backend servers are socket backend servers,and  
nginx seems only support unix socket and http backend server.  
is any way to achieve that?  
thanks

Posted at Nginx Forum:

> **[could nginx support the socket backend server(in different machines) ?](https://forum.nginx.org/read.php?2,21767,21767#msg-21767)**
>
> for several reasons,the backend servers are socket backend servers,and nginx seems only support unix socket and http backend server. is any way to achieve that? thanks

---

<div class="post-metadata">

**Author:** ![wangbin579](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/bc79bd/32.png) [@wangbin579](https://www.ruby-forum.com/u/wangbin579)\
**Post date:** [November 10, 2009, 11:42am UTC](https://www.ruby-forum.com/t/could-nginx-support-the-socket-backend-server-in-different-machines/178733/2 "2009-11-10T11:42:18Z")

</div>

no, your statement was wrong, using fastcgi, you can use network socket  
(eg.  
using spawn-fcgi)  
some example:  
[http://wiki.nginx.org/NginxV8cgi](http://wiki.nginx.org/NginxV8cgi)

---

<div class="post-metadata">

**Author:** ![wangbin579](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/bc79bd/32.png) [@wangbin579](https://www.ruby-forum.com/u/wangbin579)\
**Post date:** [November 10, 2009, 11:46am UTC](https://www.ruby-forum.com/t/could-nginx-support-the-socket-backend-server-in-different-machines/178733/3 "2009-11-10T11:46:24Z")

</div>

sorry, to quickly pressing the send button ^^  
just put the fastcgi server on another machine…

---

<div class="post-metadata">

**Author:** ![wangbin579](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/bc79bd/32.png) [@wangbin579](https://www.ruby-forum.com/u/wangbin579)\
**Post date:** [November 10, 2009, 7:53pm UTC](https://www.ruby-forum.com/t/could-nginx-support-the-socket-backend-server-in-different-machines/178733/4 "2009-11-10T19:53:58Z")

</div>

Unix domain sockets are _not_ network sockets:

> **[Unix domain socket](https://en.wikipedia.org/wiki/Unix_domain_socket)**
>
> A Unix domain socket aka UDS or IPC socket (inter-process communication socket) is a data communications endpoint for exchanging data between processes executing on the same host operating system. It is also referred to by its address family AF\_UNIX. Valid socket types in the UNIX domain are:
> The Unix domain socket facility is a standard component of POSIX operating systems.
> The API for Unix domain sockets is similar to that of an Internet socket, but rather than using an underlying network pro...

They work on localhost only. You will need to use HTTP proxying or  
FastCGI.

Probably what you want to do is run an Nginx instance on each backend  
server to communicate over the local socket to your app and then proxy  
to those Nginx instances from your main Nginx instance over HTTP.

Cliff

---

<div class="post-metadata">

**Author:** ![wangbin579](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/bc79bd/32.png) [@wangbin579](https://www.ruby-forum.com/u/wangbin579)\
**Post date:** [November 10, 2009, 1:11pm UTC](https://www.ruby-forum.com/t/could-nginx-support-the-socket-backend-server-in-different-machines/178733/5 "2009-11-10T13:11:51Z")

</div>

You should have a look at memcache module.
