Skip to content

@rgo /apache_vhost_mongrel_cluster.conf
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Apache with mongrel_cluster configuration to remember
# Apache configuration to remember
#NameVirtualHost *:80 # Better in apache2.conf
# Fix: "client denied by server configuration"
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
# Setup the cluster
<Proxy balancer://foo_cluster>
BalancerMember http://127.0.0.1:8075
BalancerMember http://127.0.0.1:8076
</Proxy>
# Setup the VirtualHost for your Rails application
<VirtualHost *:80>
ServerAdmin webmaster@foo.com
ServerName foo.com
ServerAlias *.foo.com
DocumentRoot /home/foo/rails/public
<Directory "/home/foo/rails/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
# Setup your Rewrite rules here
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteCond %{SCRIPT_FILENAME} !\.(js|gif|jpg|png|css)$
RewriteRule ^.*$ /system/maintenance.html [L]
# Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]
# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ $1.html [QSA]
# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://foo_cluster%{REQUEST_URI} [P,QSA,L]
# Compress common non-binary content.
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpeg|jpg|tiff|tif|png|mov|wmv|mp3|zip)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
# Error logs
#RewriteLogLevel 9
#RewriteLog "/usr/local/apache2/logs/foo_rewrite.log"
ErrorLog "/usr/local/apache2/logs/foo_error.log"
CustomLog "/usr/local/apache2/logs/foo_access.log" combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.