Created
November 4, 2009 16:54
-
-
Save garethr/226208 to your computer and use it in GitHub Desktop.
Apache virtualhost for an asset server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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