Skip to content

Instantly share code, notes, and snippets.

@huned
Created November 5, 2010 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huned/664981 to your computer and use it in GitHub Desktop.
Save huned/664981 to your computer and use it in GitHub Desktop.
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot "/home/example/apps/example_app/current/public"
<Directory "/home/example/apps/example_app/current/public">
Options -Indexes +FollowSymLinks -MultiViews -Includes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
LogLevel warn
ErrorLog /var/log/apache2/example_app.error.log
CustomLog /var/log/apache2/example_app.access.log combined
RailsEnv staging
# Deflate
AddOutputFilterByType DEFLATE text/html text/xml text/plain text/css application/x-javascript text/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Expires
ExpiresActive On
<FilesMatch "\.(ico|gif|jpe?g|JPE?G|PNG|png|js|css|flv|swf)$">
ExpiresDefault "access plus 1 month"
</FilesMatch>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{REQUEST_URI} !\.(ico|gif|jpe?g|JPE?G|PNG|png|js|css|flv|swf)$
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ %{DOCUMENT_ROOT}/system/maintenance.html [L]
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^/?(.*)$ http://www.example.com/$1 [R=301,QSA,L]
</VirtualHost>
<VirtualHost *:443>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot "/home/example/apps/example_app/current/public"
<Directory "/home/example/apps/example_app/current/public">
Options -Indexes +FollowSymLinks -MultiViews -Includes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
LogLevel warn
ErrorLog /var/log/apache2/example_app.error.log
CustomLog /var/log/apache2/example_app.access.log combined
RailsEnv staging
# Deflate
AddOutputFilterByType DEFLATE text/html text/xml text/plain text/css application/x-javascript text/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Expires
ExpiresActive On
<FilesMatch "\.(ico|gif|jpe?g|JPE?G|PNG|png|js|css|flv|swf)$">
ExpiresDefault "access plus 1 month"
</FilesMatch>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{REQUEST_URI} !\.(ico|gif|jpe?g|JPE?G|PNG|png|js|css|flv|swf)$
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ %{DOCUMENT_ROOT}/system/maintenance.html [L]
RewriteCond %{HTTPS_HOST} ^example\.com [NC]
RewriteRule ^/?(.*)$ https://www.example.com/$1 [R=301,QSA,L]
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment