Created
February 5, 2010 16:47
-
-
Save psousa/295959 to your computer and use it in GitHub Desktop.
quick notes on speeding up apache and passenger by caching images and gzipping stuff
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
#1) install mod deflate and expires on your apache | |
#Run the following commands: "a2enmod expires" and "a2enmod deflate" | |
#2) add this inside <VirtualHost> section of your Apache configuration | |
RewriteEngine On | |
RewriteCond %{QUERY_STRING} ^[0-9]{10}$ | |
RewriteRule ^(.*)$ /add_expires_header%{REQUEST_URI} [QSA] | |
<Directory "/home/user/apps/myapp/current/public/add_expires_header"> | |
ExpiresActive On | |
ExpiresDefault "access plus 10 years" | |
</Directory> | |
#2.5) optional gzip stuff | |
AddOutputFilterByType DEFLATE text/html text/css application/x-javascript application/javascript | |
#3) dont forget to add this in the end | |
#cd /home/user/apps/myapp/current/public | |
#ln -s . add_expires_header | |
#4) take a look in css and manually add timestamp to images or use css sprites for big kudos and timestamp it. | |
#5) may experience side-problems with images not being removed from cache. :P |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment