# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # :80> ServerName <%= apache_server_name %> <% apache_server_aliases_array.each do |a| %> ServerAlias <%= "#{a}" %> <% end %> DocumentRoot <%= "#{current_path}/public" %> > Options FollowSymLinks AllowOverride None Order allow,deny Allow from all # Configure mongrel_cluster > Order deny,allow Allow from all <% start_port = apache_proxy_port %> <% end_port = apache_proxy_port + apache_proxy_servers - 1 %> <% start_port.upto(end_port) do |port| %> BalancerMember http://<%= "#{apache_proxy_address}:#{port.to_s}" %> <% end %> RewriteEngine On <% if apache_ssl_enabled && apache_ssl_forward_all %> RewriteRule ^(.*)$ https://<%= domain %>$1 <% end %> # Prevent access to .svn directories RewriteRule ^(.*/)?\.svn/ - [F,L] ErrorDocument 403 "Access Forbidden" # 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 %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://<%= "#{application}_cluster" %>%{REQUEST_URI} [P,QSA,L] # Deflate AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-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 ErrorLog /var/log/apache2/<%= domain %>-error.log CustomLog /var/log/apache2/<%= domain %>-access.log combined