# 403 (Forbidden) with Apache on Mongrel Cluster

**URL:** <https://www.ruby-forum.com/t/403-forbidden-with-apache-on-mongrel-cluster/196476>\
**Category:** Rails\
**Created:** [October 3, 2007, 3:38pm UTC](https://www.ruby-forum.com/t/403-forbidden-with-apache-on-mongrel-cluster/196476 "2007-10-03T15:38:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![knb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7ab992/32.png) [@knb](https://www.ruby-forum.com/u/knb)\
**Post date:** [October 3, 2007, 3:38pm UTC](https://www.ruby-forum.com/t/403-forbidden-with-apache-on-mongrel-cluster/196476/1 "2007-10-03T15:38:24Z")

</div>

Hi,

I’ve configured a rails application on my VPS to run on two  
mongrels. When I run curl on localhost, the starting page comes up  
fine. That is, mongrel is serving the app perfectly.

The problem arises when trying to access the app on my ip through  
apache. I  
get a 403 error. Just to test things out, I’ve set generous  
permissions on the entire rails directory structure still to no avail.

I’ve also set up a non-rails virtual host, and everything works fine  
there. So I doubt that it’s a vhost problem.

What could be the problem here? Any insights would be awesome; to me,  
it’s been a real gordian knot.

Thanks,

Kyle

---

<div class="post-metadata">

**Author:** ![knb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7ab992/32.png) [@knb](https://www.ruby-forum.com/u/knb)\
**Post date:** [October 3, 2007, 3:55pm UTC](https://www.ruby-forum.com/t/403-forbidden-with-apache-on-mongrel-cluster/196476/2 "2007-10-03T15:55:22Z")

</div>

knb wrote:

> I’ve also set up a non-rails virtual host, and everything works fine  
> there. So I doubt that it’s a vhost problem.
> 
> What could be the problem here? Any insights would be awesome; to me,  
> it’s been a real gordian knot.

Hard to say without seeing your Apache config and Mongrel config/command  
line.

–  
Michael W.

---

<div class="post-metadata">

**Author:** ![knb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7ab992/32.png) [@knb](https://www.ruby-forum.com/u/knb)\
**Post date:** [October 3, 2007, 5:05pm UTC](https://www.ruby-forum.com/t/403-forbidden-with-apache-on-mongrel-cluster/196476/3 "2007-10-03T17:05:46Z")

</div>

On 3 Oct 2007, at 15:09, knb wrote:

> Thanks, Michael.
> 
> Here’s the relevant config info.

Well either your mail client has munged your config or it’s rather  
malformed. You’re not closing the VirtualHost ‘tags’, sections are  
duplicated, you’ve nested the balancer declarations inside the  
Virtual host stuff etc…

In particular you declare your cluster as mongrel\_cluster, but in  
your rewrite rule you’ve put your\_app\_cluster

Fred

---

<div class="post-metadata">

**Author:** ![knb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7ab992/32.png) [@knb](https://www.ruby-forum.com/u/knb)\
**Post date:** [October 3, 2007, 4:10pm UTC](https://www.ruby-forum.com/t/403-forbidden-with-apache-on-mongrel-cluster/196476/4 "2007-10-03T16:10:06Z")

</div>

Thanks, Michael.

Here’s the relevant config info.

\<VirtualHost \*:80\>  
ServerName [lessonkit.com](http://lessonkit.com)  
DocumentRoot /home/kyle/public\_html/lessonkit.com/current/public

\<Directory “/home/kyle/public\_html/lessonkit.com/current/public”\>  
Options FollowSymLinks  
AllowOverride None  
Order allow,deny  
Allow from all

RewriteEngine On  
\<Proxy balancer://mongrel\_cluster\>  
BalancerMember [http://127.0.0.1:5000](http://127.0.0.1:5000)  
BalancerMember [http://127.0.0.1:5001](http://127.0.0.1:5001)

\<VirtualHost \*:80\>  
ServerName [lessonkit.com](http://lessonkit.com)  
DocumentRoot /home/kyle/public\_html/lessonkit.com/current/public

\<Directory “/home/kyle/public\_html/lessonkit.com/current/public”\>  
Options FollowSymLinks  
AllowOverride None  
Order allow,deny  
Allow from all

RewriteEngine On  
\<Proxy balancer://mongrel\_cluster\>  
BalancerMember [http://127.0.0.1:5000](http://127.0.0.1:5000)  
BalancerMember [http://127.0.0.1:5001](http://127.0.0.1:5001)

RewriteCond %{DOCUMENT\_ROOT}/maintenance.html -f  
RewriteCond %{SCRIPT\_FILENAME} !maintenance.html  
RewriteRule ^.\*$ /maintenance.html [L]  
RewriteRule ^/$ /index.html [QSA]

# Rewrite to check for Rails cached pages with .html extentions

RewriteRule ^([^.]+)$ $1.html [QSA]

# All dynamic requests get sent to the cluster

RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} !-f  
RewriteRule ^/(.\*)$ balancer://your\_app\_cluster%{REQUEST\_URI}  
[P,QSA,L]

# Deflate for clients that support it.

AddOutputFilterByType DEFLATE text/html text/plain text/xml  
BrowserMatch ^Mozilla/4 gzip-only-text/html  
BrowserMatch ^Mozilla/4.0[678] no-gzip  
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Error and access logs.

ErrorLog logs/your\_app\_error\_log  
CustomLog logs/your\_access\_log combined

Here’s my mongrel config:

cwd: /home/kyle/public\_html/lessonkit.com/current  
log\_file: /home/kyle/public\_html/lessonkit.com/current/log/mongrel.log  
port: “5000”  
environment: production  
address: 127.0.0.1  
pid\_file: /home/kyle/public\_html/lessonkit.com/current/tmp/pids/  
mongrel.pid  
servers: 2
