Prerequisites
- mod_rails: see for installation instructions for passenger/mod_rails.
- apache configs: see for gzip.conf, deflate.conf, and cache.conf.
Apache configuration:
NameVirtualHost 123.45.67.89:80
NameVirtualHost 123.45.67.89:443
##
## HTTP -- redirect to https
##
<VirtualHost 123.45.67.89:80>
ServerName my.domain.ørg
RewriteEngine On
RewriteRule ^.*$ https://my.domain.ørg%{REQUEST_URI} [R=permanent,L]
</VirtualHost>
##
## HTTPS
##
<VirtualHost 123.45.67.89:443>
ServerName my.domain.ørg
ServerAlias your.domain.ørg
SSLEngine on
SSLCipherSuite HIGH:MEDIUM:-SSLv2:-aNULL
SSLCACertificateFile /etc/certs/roots/ca-root.pem
SSLCertificateKeyFile /etc/certs/key.pem
SSLCertificateFile /etc/certs/cert.pem
RequestHeader set X_FORWARDED_PROTO 'https'
DocumentRoot /usr/apps/crabgrass/current/public
<Directory "/usr/apps/crabgrass/current/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Header set Cache-Control "Public"
Include /etc/apache2/conf.d/expire.conf
Include /etc/apache2/conf.d/gzip.conf
</Directory>
Include /etc/apache2/conf.d/deflate.conf
# Check for maintenance file and redirect all requests
RailsAllowModRewrite on
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ %{DOCUMENT_ROOT}/system/maintenance.html [L]
</VirtualHost>