Configuring nginx + couchdb to deploy a couchapp as a public facing website.

February 3, 2011. code, couchdb, nginx

Three things to remember while configuring a couchapp to run as a web facing application. Below, I document the steps I took to deploy the example pages app from

  1. set the vhost in /etc/couchdb/local.ini.
    [vhosts] = /pages/_design/pages/_rewrite
  1. add vhosts entry to couchdb by visiting configuration page in futon app and adding a new section:
    section = vhosts
    option =
    value = /pages/_design/pages/_rewrite
  1. configure nginx to proxy the requests to / to the port running couchdb. See ref
    location / {
        proxy_pass http://localhost:5984;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Securing the web app with SSL.

Primary reference for securing the above installation with SSL certificates is :

I followed the instructions verbatim with success.


Use curl client to access https + basic_auth enabled site.

curl --cacert \

This returns the page contents as expected.