[Home]Install/Mongrel Cluster With Apache 2.2

HomePage | Install | RecentChanges | Preferences

Azureus on Rails can be run with Apache 2.2 proxying requests to a cluster of Mongrel instances. Requests for static files are served by Apache.

find azureusonrails/public -type d -print0 | xargs --null chmod o+x
find azureusonrails/public -type f -print0 | xargs --null chmod o+r
chmod o+r azureusonrails/public/.htaccess
chmod o+x azureusonrails

gem install mongrel_cluster

mongrel_rails cluster::configure -e production -p 8000 -N 3 -c /home/azureus/azureusonrails -a 127.0.0.1 --user azureus --group azureus

mongrel_rails cluster::start

<VirtualHost *:80>
  ServerName azureus.example.org
  DocumentRoot /home/azureus/azureusonrails/public

  <Directory /home/azureus/azureusonrails/public>
    AllowOverride FileInfo Indexes
  </Directory>

  RewriteEngine On

  # Redirect all non-static requests to Mongrel
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ balancer://azureusonrails%{REQUEST_URI} [P,QSA,L]

  ProxyPassReverse / balancer://azureusonrails
  ProxyPreserveHost on

  <Proxy balancer://azureusonrails>
    BalancerMember http://localhost:8000
    BalancerMember http://localhost:8001
    BalancerMember http://localhost:8002
  </Proxy>

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  # Block access to .svn directories
  <DirectoryMatch "^/.*/\.svn/">
    ErrorDocument 403 /404.html
    Order allow,deny
    Deny from all
    Satisfy All
  </DirectoryMatch>
</VirtualHost>

You will probably also want to add options to the virtual host configuration to require authentication or restrict access to specific IP addresses.

To stop the Mongrel cluster, run:

mongrel_rails cluster::stop

Further information about mongrel_cluster, including instructions for setting up an init.d script to start the cluster at boot time can be found at http://mongrel.rubyforge.org/docs/mongrel_cluster.html.


HomePage | Install | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited October 29, 2010 9:09 am by perses.rsuk.com (diff)
Search: