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


#1

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


#2

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


#3

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

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


#4

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


#5

aaah okay know I know:


<Proxy balancer://aekschencluster>
BalancerMember 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

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

What could I do?

Greetings Andi


#6

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