Configuring nginx + couchdb to deploy a couchapp as a public facing website.
Created:
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 couchapp.org.
- set the vhost in
/etc/couchdb/local.ini
.
[vhosts]
home.btbytes.com = /pages/_design/pages/_rewrite
- add vhosts entry to couchdb by visiting
configuration
page in futon app and adding a new section:
section = vhosts
option = home.btbytes.com
value = /pages/_design/pages/_rewrite
- 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 :
- Setting Up Nginx With SSL For CouchDB Basic Authentication
- Generating self signed cerficates (referred in above link).
I followed the instructions verbatim with success.
Tests
Use curl
client to access https
+ basic_auth
enabled site.
curl https://user:password@home.btbytes.com/page/index --cacert \
/etc/ssl/certs/home.btbytes.com.crt
This returns the page contents as expected.