How to Speed Up Apache Passenger Rails
- 1). Open a shell or terminal command line interface and log in to your Web server using a login that has administrative privileges.
- 2). Run the following commands in the following sequence:
a2enmod expires
a2enmod deflate - 3). Open the vhost configuration file in your Ruby on Rails application and add the following line of code, which will compress HTML, CSS, and JavaScript files used in your application:
AddOutputFilterByType DEFLATE text/html text/css application/x-javascript application/javascript - 4). Add the following line of code to expire image header documents, which will expire certain file types when they are no longer being used, thus freeing up cache space for Passenger:
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
Source...