Skip to content

Instantly share code, notes, and snippets.

@psousa
Created February 5, 2010 16:47
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 psousa/295959 to your computer and use it in GitHub Desktop.
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
#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