How setup proxy to glue couchDB to Rails?

Cliff Wells cliff at develix.com
Mon Apr 5 09:12:09 MSD 2010


On Sun, 2010-04-04 at 20:07 -0700, Audrey Lee wrote:
> Hello nginx people,
> 
> Is it possible to use nginx to "glue" 2 types of servers into one?

You mean "proxy".   Yes, Nginx is a proxy.

> I have a rails server running here:
>   http://localhost:3000/rails/
> 
> And I have a couchDB server running here:
>   http://localhost:5984/
> 
> I'd like to configure nginx so that it listens on 8080
> 
> I want any request directed at:
>   http://localhost:8080/rails/
> to be forwarded to
>   http://localhost:3000/rails/
> And I want all other requests to be forwarded to
>   http://localhost:5984/

server {
   server_name localhost;
   listen 8080;

   location /rails {
       proxy_pass http://localhost:3000;
       include proxy.conf; # other proxy settings - see docs
   }

   location / {
       proxy_pass http://localhost:5984;
       include proxy.conf; # other proxy settings - see docs
   }
}

I think I'd not want to send *anything* that isn't under /rails to
CouchDB, but that's what you asked for.

> Have any of you done something like this?

Probably most anyone who's read the documentation on proxying:

http://wiki.nginx.org/NginxHttpProxyModule


> Is nginx well suited for this or should I be learning about a true
> proxy like squid or varnish?

Nginx is a true proxy.   Squid and Varnish are *caching* proxies, Nginx
has some caching capabilities as well, although not as sophisticated
(nor as complicated).

Regards,
Cliff





More information about the nginx mailing list