Load Balancing Rails on Apache 2.x
- by revgum
My situation is that I need to proxy traffic to the root of my web server to port 81 for IIS, and then any traffic to a sub-directory needs to be directed to the rails app.
my-server.com/ - needs to proxy to port 81
my-server.com/myapp - needs to point to the rails app
This seems to be working alright for the rails application but the images, javascripts, and stylesheets are not actually working (proxied). I've tried to fiddle with the proxypass lines but it still doesn't work for me..can anyone help?
Here's my complete VirtualHost portion of the config;
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ProxyRequests off
<Proxy balancer://myapp_cluster>
BalancerMember http://127.0.0.1:3001
BalancerMember http://127.0.0.1:3002
</Proxy>
<VirtualHost *:80>
DocumentRoot "c:\ruby\apps\myapp\public"
<Directory /myapp >
Options FollowSymLinks
AllowOverride None
</Directory>
ProxyPass /myapp/images !
ProxyPass /myapp/stylesheets !
ProxyPass /myapp/javascripts !
ProxyPass /myapp/ balancer://myapp_cluster/
ProxyPassReverse /myapp/ balancer://myapp_cluster/
ProxyPreserveHost on
ProxyPass / http://localhost:81/
ErrorLog "c:\ruby\apps\myapp\log\error.log"
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog "c:\ruby\apps\myapp\log\access.log" combined
</VirtualHost>