Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<VirtualHost *:80>
RewriteEngine On
# Redirect any non HTTPS requests to the HTTPS server
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]
Include /etc/apache2/common/hide-svn
Include /etc/apache2/common/deflate
NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine on
# Self-signed
# SSLCertificateFile /etc/apache2/apache.pem
SSLCertificateFile /etc/apache2/ssl/2009/
SSLCertificateKeyFile /etc/apache2/ssl/2009/
# this is only needed for GoDaddy certificates
SSLCertificateChainFile /etc/apache2/ssl/2009/gd_bundle.crt
RequestHeader set X_FORWARDED_PROTO 'https'
ServerAdmin webmaster@localhost
RewriteEngine On
## Bit faster by storing the Rails Framework in memory but not needed at this scale
# RailsSpawnMethod smart
RailsAppSpawnerIdleTime 0
DocumentRoot /home/websites/
<Directory "/home/websites/">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
# Uncomment for rewrite debugging
# RewriteLog /tmp/myapp_rewrite_log
# RewriteLogLevel 9
# 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 ^/$ /cache/index.html [QSA]
# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ /cache/$1.html [QSA]
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/admin-access.log combined
ServerSignature Off
Include /etc/apache2/common/hide-svn
Include /etc/apache2/common/deflate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment