Reverse Proxy in Apache2 (Ubuntu 10.04) for CouchDB

This specific content was written 13 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

Installing Modules

There are various sites with instructions that did not work.
However, following the instructions here> http://abhirama.wordpress.com/2008/11/03/apache-mod_proxy-in-ubuntu/ did the trick.

The reverse proxy module was installed:

sudo apt-get install libapache2-mod-proxy-htm

Libxml was installed:

apt-get install libxml2-dev

Edit apache2.conf

The following was added to the apache2.conf file:

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
LoadFile /usr/lib/libxml2.so

VirtualHost config

Finally, below is the VirtualHost config I personally used based on advice from http://bennolan.com/2011/01/10/couchdb-behind-apache.html in order to get CouchDB to work correctly.

<VirtualHost *:80>

ServerAdmin webmaster@localhost

Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers Content-Type
Header set Access-Control-Allow-Methods "GET, PUT, OPTIONS, DELETE, POST"
Header set Access-Control-Max-Age 3600

DocumentRoot /var/www

ProxyPass / http://localhost:5984/ nocanon
ProxyPassReverse / http://localhost:5984/

Options FollowSymLinks
AllowOverride None

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128

</Directory>

</VirtualHost>



Menelaos Bakopoulos

Mr. Menelaos Bakopoulos is currently pursuing his PhD both at Center for TeleInFrastruktur (CTiF) at Aalborg University (AAU) in Denmark and Athens Information Technology (AIT) in Athens, Greece. He received a Master in Information Technology and Telecommunications Systems from Athens Information Technology and a B.Sc. in Computer Science & Management Information Systems from the American College of Thessaloniki. Since April 2008 he has been a member of the Multimedia, Knowledge, and Web Technologies Group.

More Posts