Skip to content

Instantly share code, notes, and snippets.

@garethr
Created November 4, 2009 16:54
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 garethr/226208 to your computer and use it in GitHub Desktop.
Save garethr/226208 to your computer and use it in GitHub Desktop.
Apache virtualhost for an asset server
<VirtualHost *:80>
ServerName assets
FileETag none
ExpiresActive On
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
RewriteEngine on
RewriteRule /(.*).min.(.*).(css|js)$ /$1.min.$3 [PT,L]
RewriteRule /([a-zA-Z0-9/\-_]*)\.([a-zA-Z0-9]+)\.(png|jpg|gif)$ /$1.$3 [PT,L]
<Directory />
Options -Indexes
AllowOverride None
</Directory>
Alias / /path/to/assets/
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /dev/null combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment