Monday, September 10th, 2007...9:20 am

Running rails with mongrel for a specific sub directory

Jump to Comments

I've started using mongrel for running rails apps with apache2 and mod_proxy , it works like a charm and allows you to run multiple rails apps and mongrel instances on one server.

Your proxy setup looks like this in your httpd.conf or vhost.conf

<VirtualHost *:80>
    ServerName myapp.com
    ServerAlias www.myapp.com

    ProxyPass /myapp http://www.myapp.com:8000/
    ProxyPassReverse /myapp http://www.myapp.com:8000
    ProxyPreserveHost on
  </VirtualHost>

Then in your environment.rb add:

ActionController::AbstractRequest.relative_url_root = '/myapp'

This will make ActionController rewrite the proper URL for your rails application.

1 Comment

  • I honestly appreciate it and will probably be re-visting to scan through considerably more.A great many thanks on your astounding web publication.

Leave a Reply