Arc Forumnew | comments | leaders | submitlogin
6 points by lojic 6117 days ago | link | parent

Here's an Apache virtual host config that allows Apache to sit in front of an Arc web server via mod_proxy_balancer. I just took my typical Rails config and tweaked it slightly. You need to have the mod_proxy_balancer module loaded.

I've setup a pseudo IP of 10.0.0.71 and put www.lojic.com in my /etc/hosts file with that IP for testing. I'll try 2 Arc processes with sticky sessions later, but for one server the following works fine. If you don't have a bunch of other virtual hosts active, you could probably just use 127.0.0.1 w/o setting up the pseudo IP.

Having Apache sit in front of the Arc server allows using SSL easily, serving up static files directly for extra speed, etc.

  <VirtualHost 10.0.0.71:80>
    ServerName www.lojic.com
    ServerAlias lojic.com
    DocumentRoot /home/brian/software/arc/arc2

    <Directory /home/brian/software/arc/arc2 >
      Options FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
    </Directory>

    # Configure cluster
    <Proxy balancer://lojic_cluster>
      BalancerMember http://127.0.0.1:8080
    </Proxy>

    RewriteEngine On

    # Prevent access to .svn directories
    RewriteRule ^(.*/)?\.svn/ - [F,L]
    ErrorDocument 403 "Access Forbidden"

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

    # Deflate
    AddOutputFilterByType DEFLATE text/html text/plain text/xml
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    ErrorLog logs/www.lojic.com-error_log
    CustomLog logs/www.lojic.com-access_log combined
  </VirtualHost>