Trying to set up Apache2 as a proxy for mongrel on my new Ruby on Rails server, following the instructions on the mongrel site. I kept getting “403 Forbidden” errors on every request. I found a comment that seemed to describe the same situation. Sure enough, editing /etc/apache2/mods-enabled/proxy.conf to change “Deny” to “Allow” fixed the problem. I kept ProxyRequests turned off, which is supposed to prevent my site from becoming an open proxy, but I’m still nervous about removing that “Deny” directive. I wish there were a more authoritative source of information on this.
Here is my configuration:
ServerName ninjarailsapp.com:80
ProxyRequests Off
ProxyPreserveHost On
RewriteEngine On
RewriteRule ^/(.*) http://127.0.0.1:4000/$1 [P,L]
ProxyPassReverse / http://127.0.0.1:4000/
ErrorLog logs/ninja_error_log
CustomLog logs/ninja_access_log combined
Bah, forgot to escape less-than and greater-than:
<VirtualHost *:80>
ServerName ninjarailsapp.com:80
ProxyRequests Off
ProxyPreserveHost On
RewriteEngine On
RewriteRule ^/(.*) http://127.0.0.1:4000/$1 [P,L]
ProxyPassReverse / http://127.0.0.1:4000/
ErrorLog logs/ninja_error_log
CustomLog logs/ninja_access_log combined
</VirtualHost>
A more authoritative source? Ahem, http://httpd.apache.org/docs/2.2/mod/mod_proxy.html