# zena apache2 vhost for <%= config[:host] %> # automatically generated file ServerName <%= config[:host] %> DocumentRoot <%= config[:sites_root] %>/<%= config[:host] %>/public ErrorLog <%= config[:sites_root] %>/<%= config[:host] %>/log/apache2.error.log CustomLog <%= config[:sites_root] %>/<%= config[:host] %>/log/apache2.access.log combined /<%= config[:host] %>/public"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all <% if config[:static].include?('cgi-bin') %> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ AllowOverride None Options ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all <% end %> <% if config[:static].include?('awstats-icon') %> Alias /awstats-icon/ /usr/share/awstats/icon/ Options None AllowOverride None Order allow,deny Allow from all <% end %> # hide all .whatever files ErrorDocument 403 /404.html Order allow,deny Deny from all Satisfy All <% if config[:app_type] == :mongrel %> RewriteEngine On <% if config[:debug_rewrite] %> # rewrite debugging RewriteLog <%= config[:sites_root] %>/<%= config[:host] %>/log/rewrite.log RewriteLogLevel 9 <% end %> # Check for maintenance file and redirect all requests RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f RewriteCond %{SCRIPT_FILENAME} !maintenance.html 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 %{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://<%= config[:balancer] %>%{REQUEST_URI} [P,QSA,L] <% elsif config[:app_type] == :passenger %> PassengerAppRoot <%= config[:app_root] %> # enable tracking uploads in / TrackUploads On # enable upload progress reports ReportUploads On <% end %> <% if config[:deflate] %> # Deflate (compress data before sending to browser) AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html <% end %> <% if config[:debug_deflate] && config[:deflate] %> # Deflate debugging DeflateFilterNote Input input_info DeflateFilterNote Output output_info DeflateFilterNote Ratio ratio_info LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate CustomLog <%= config[:sites_root] %>/<%= config[:host] %>/log/deflate.log deflate <% end %>