Skip to content

Instantly share code, notes, and snippets.

@HendrikLouw
Created October 28, 2008 18:43
Show Gist options
  • Save HendrikLouw/20468 to your computer and use it in GitHub Desktop.
Save HendrikLouw/20468 to your computer and use it in GitHub Desktop.
# Template for apache config that uses expiry headers, gzip compression and etags
# Mainly aimed at Rails apps that run on passenger but I could use this everywhere else
<VirtualHost *:80>
ServerName servername.com
ServerAlias servername.com
DocumentRoot /var/rails/servername.com/public
SetOutputFilter DEFLATE
<Directory "/var/rails/servername.com/current/public">
#Gzip
AddOutputFilterByType DEFLATE text/html text/css text/javascript
#Expiry headers
<ifmodule mod_expires.c>
<filesmatch "\.(ico|jpg|jpeg|gif|png|css|js|swf|flv|pdf)$">
ExpiresActive on
ExpiresDefault "access plus 1 year"
</filesmatch>
</ifmodule>
# ETags
FileETag MTime Size
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
CustomLog /var/log/server-name-access.log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment