couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Couchdb Wiki] Update of "Virtual_Hosts" by TimSmith
Date Tue, 12 Oct 2010 03:19:27 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Virtual_Hosts" page has been changed by TimSmith.
The comment on this change is: Initial documentation of [vhosts].


New page:
CouchDB, since 0.11.0, can map requests to different locations based on the `Host` header.
This allows different virtual hosts on the same machine to map to different databases or design
documents, etc. The most common use case is to map a virtual host to a [[Rewriting_urls|Rewrite
Handler]], to provide full control over the application's URIs.

To add a virtual host, add a CNAME pointer to the DNS for your domain name. For development
and testing, it is sufficient to add an entry in the hosts file (`/etc/hosts` on Unix-like
operating systems) pointing to  For example: {{{
# Aliases for CouchDB vhosts, see /etc/couchdb/local.ini       sofa.couchdb

Test that this is working: {{{
$ ping sofa.couchdb
PING sofa.couchdb ( 56(84) bytes of data.
64 bytes from localhost.localdomain ( icmp_req=1 ttl=64 time=0.025 ms
64 bytes from localhost.localdomain ( icmp_req=2 ttl=64 time=0.051 ms

Finally, add an entry to your [[Configurationfile_couch.ini|Configuration File]] in the [vhosts]
section: {{{
sofa.couchdb:5984 = /sofa/_design/sofa/_rewrite

If your CouchDB is listening on the default HTTP port, or is sitting behind a proxy, then
don't specify a port number in the vhost key.

With the above setup, a request to `http://sofa.couchdb:5984/sweet-o` will be mapped to ``.

View raw message