Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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
# Setup the cluster
<Proxy balancer://foo_cluster>
# Setup the VirtualHost for your Rails application
<VirtualHost *:80>
ServerAlias *
DocumentRoot /home/foo/rails/public
<Directory "/home/foo/rails/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
# 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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment