Like Bob mentioned…  the user that runs CouchDB needs to be a sudoer in order to bind to a port less that 1024.

On Nov 12, 2013, at 2:27 AM, Alexander Gabriel <>

Hi Jim

I had some trouble configuring my local.ini file.


port = 80

doesn't work because I get a "Connection refused" answer when connecting
with curl.

see above comment.

The only way I got it working was:

port = 5984
bind_address =

then redirecting form 5984 to 80: "iptables -t nat -A PREROUTING -p tcp
--dport 80 -j REDIRECT --to-ports 5984"

Is this the reason form my trouble with rewrites?

I'm definitely not an iptables guy… I'd have to look at the manpage to figure out exactly what that incantation maps to… as well see the other rules you have enabled, since they can effect what you add.  Typicaly to make that kind of change to iptables, you'd need to: 

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 5984

Since I'm usually running both CouchDB and an application server or some sort on the same machine - I typically use NGINX or Apache to do a reverse proxy if I need external access to couchdb as I can be a bit more fine grained than iptables.

The vhost I set was: =

since you have used a bind_address of…  you should be able to access couchdb just by opening your browser to "", and your rewrites should just work, provided you have good "from" and "to" specified, and port 5984 isn't blocked from external access for some reason.  

If you want it to work on port 80, besides getting you iptables configuration working, you also need a vhost entry in CouchDB local.ini file:

I believe you can have multiple vhosts just using different ports or I think you can omit the port and it will redirect from any port.  Unless you are trying to access different rewrite handlers from the same domain using different ports, it's pretty safe to just omit the port number AFAIK.