# Rails + Apache2 + Balancer Manager - PHP doesn't work

**URL:** <https://www.ruby-forum.com/t/rails-apache2-balancer-manager-php-doesnt-work/150698>\
**Category:** Rails\
**Created:** [October 11, 2008, 7:16pm UTC](https://www.ruby-forum.com/t/rails-apache2-balancer-manager-php-doesnt-work/150698 "2008-10-11T19:16:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [October 11, 2008, 7:16pm UTC](https://www.ruby-forum.com/t/rails-apache2-balancer-manager-php-doesnt-work/150698/1 "2008-10-11T19:16:54Z")

</div>

Hi

I have a Debian Server and I managed that Ruby works with Apache2 and  
the Balancer Manager that listen to the Mongrel server.

The Problem is that PHP files don’t work anymore.

How do I have to configurate the Balance Manager that PHP is working  
again like without the Balance Manager?

Greetings Andi

---

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [October 11, 2008, 9:46pm UTC](https://www.ruby-forum.com/t/rails-apache2-balancer-manager-php-doesnt-work/150698/2 "2008-10-11T21:46:17Z")

</div>

You are going to have a virtualhost that does not forward all request  
to your mongrel… If the request is sent to a mongrel you will ne be  
able to render the php file…

SO here are some basics:

DirectoryIndex index.php DocumentRoot "/disk/phpcode"

alias /railscode/javascripts /disk/railscode/public/javascripts  
alias /railscode/images /disk/railscode/public/images

\<Directory “/disk/phpcode”\>  
Options FollowSymLinks  
AllowOverride None  
Order allow,deny  
Allow from all

\<Directory “/disk/railscode/public”\>  
Options FollowSymLinks  
AllowOverride None  
Order allow,deny  
Allow from all

\<Location “/railscode”\>  
proxyPass balancer://mongrel/railscode

---

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [October 12, 2008, 11:08am UTC](https://www.ruby-forum.com/t/rails-apache2-balancer-manager-php-doesnt-work/150698/3 "2008-10-12T11:08:43Z")

</div>

Hi Freddy

I am operating under ISPConfig, this is my Vhost File:

* * *

NameVirtualHost xx.xx.xx.xx:80  
  
ServerName localhost  
ServerAdmin root@localhost  
DocumentRoot /var/www/sharedip  
  
RewriteEngine on  
RewriteCond %{REQUEST\_METHOD} ^(TRACE|TRACK)  
RewriteRule .\* - [F]

\<Proxy balancer://aekschencluster\>

# Mitglieder des Clusters

BalancerMember [http://xx.xx.xx.xx:82](http://xx.xx.xx.xx:82)

ExtendedStatus On

ProxyRequests Off  
#ProxyPass /balancer-manager !  
#ProxyPass /server-status !  
ProxyPass / balancer://aekschencluster/  
ProxyPassReverse / balancer://aekschencluster/

ServerName www.domain.tdl:80  
ServerAdmin removed\_email\_address@domain.invalid  
DocumentRoot /var/www/web1/web  
ServerAlias domain.tdl  
DirectoryIndex index.html index.htm index.php index.php5 index.php4  
index.php3 index.shtml index.cgi index.pl index.jsp Default.htm  
default.htm  
Alias /cgi-bin/ /var/www/web1/cgi-bin/  
AddHandler cgi-script .cgi  
AddHandler cgi-script .pl  
ErrorLog /var/www/web1/log/error.log  
AddType application/x-httpd-php .php .php3 .php4 .php5  
php\_admin\_flag safe\_mode Off  
  
\<Directory /var/www/web1/web\>  
#Options +ExecCGI  
Options FollowSymLinks  
AllowOverride None  
Order allow,deny  
Allow from all  
  
RubyRequire apache/ruby-run  
#RubySafeLevel 0  
\<Files _.rb\>  
SetHandler ruby-object  
RubyHandler Apache::RubyRun.instance_  
   
_\<Files .rbx\>  
SetHandler ruby-object  
RubyHandler Apache::RubyRun.instance_  
   
   
_AddType text/html .shtml  
AddOutputFilter INCLUDES .shtml  
Alias /error/ “/var/www/web1/web/error/”  
ErrorDocument 400 /error/invalidSyntax.html  
ErrorDocument 401 /error/authorizationRequired.html  
ErrorDocument 403 /error/forbidden.html  
ErrorDocument 404 /error/fileNotFound.html  
ErrorDocument 405 /error/methodNotAllowed.html  
ErrorDocument 500 /error/internalServerError.html  
ErrorDocument 503 /error/overloaded.html  
AliasMatch ^/~([^/]+)(/(.))? /var/www/web1/user/$1/web/$3  
AliasMatch ^/users/([^/]+)(/(._))? /var/www/web1/user/$1/web/$3  
  
RewriteEngine on  
RewriteCond %{REQUEST\_METHOD} ^(TRACE|TRACK)  
RewriteRule .\* - [F]

* * *

The ruby projekt is under var/www/web1/  
The ruby public is under a symlink var/www/web1/public to  
var/www/web1/web/  
The normal apache is under var/www/web1/web/

Is the error coming from the missing Directory entry?

Greetings Andi

---

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [October 12, 2008, 9:20pm UTC](https://www.ruby-forum.com/t/rails-apache2-balancer-manager-php-doesnt-work/150698/4 "2008-10-12T21:20:10Z")

</div>

okay I found an other solution.

I did it the other way around:

ProxyPass /phpBB3 !  
ProxyPass / balancer://aekschencluster/ stickysession=JSESSIONID

I set the phpBB3 Forum as an exception.

greetings

---

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [October 12, 2008, 7:36pm UTC](https://www.ruby-forum.com/t/rails-apache2-balancer-manager-php-doesnt-work/150698/5 "2008-10-12T19:36:04Z")

</div>

aaah okay know I know:

* * *

\<Proxy balancer://aekschencluster\>  
BalancerMember [http://xx.xx.xx.xx:82](http://xx.xx.xx.xx:82)

\<Location /de/\>  
ProxyPass balancer://aekschencluster/ stickysession=JSESSIONID  
#ProxyPassReverse balancer://aekschencluster/de/

* * *

With the location tag you define a URL when the proxy should be active.

But my problem is know the link routing from rails because the URL is  
now [http://www.domain.tdl/de/rubyapplication](http://www.domain.tdl/de/rubyapplication)

But in my Rails application the links route all to the root  
[http://www.domain.tdl/](http://www.domain.tdl/)

What could I do?

Greetings Andi

---

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [October 13, 2008, 2:06am UTC](https://www.ruby-forum.com/t/rails-apache2-balancer-manager-php-doesnt-work/150698/6 "2008-10-13T02:06:04Z")

</div>

Depends on the rails backed but if you are using mongrel or thin you  
can setup a prefix for the app…

setup a prefix of /app and then in the balancer you use ProxyPass /  
balancer://cluster/app
