For all of my servers (fedora based) I have a file that looks like this. I save it in /etc/httpd/conf.d/speed.conf

The following code that apache will load will make static files (images, audio,video) to be cached for a year which will make the browsers load them just once which will result in page load speed increase

<IfModule mod_expires.c>
ExpiresActive on

ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"

ExpiresByType text/css "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"

ExpiresByType image/x-icon "access plus 1 year"

ExpiresByType application/pdf "access plus 1 year"
ExpiresByType audio/x-wav "access plus 1 year"
ExpiresByType audio/mpeg "access plus 1 year"
ExpiresByType audio/mp3 "access plus 1 year"
ExpiresByType video/mpeg "access plus 1 year"
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/quicktime "access plus 1 year"
ExpiresByType video/x-ms-wmv "access plus 1 year"
ExpiresByType application/x-shockwave-flash "access plus 1 year"
</IfModule>

 

If you add the following lines apache will compress the content of the static files and they will be delivered a lot quicker because of the compression.

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/html text/css text/javascript application/x-javascript text/xml application/rss+xml application/rdf+xml application/atom+xml
</IfModule>

 

If you want a quick way to enable compression and you're using WordPress follow this tutorial which walks you through how to enable it. It is a partial compression e.g. php files but will still provide some speed increase

http://workfunc.com/gzip-compression-make-wordpress-fly/

Disclaimer: The content in this post is for educational purposes only. Always remember to take a backup before doing any of the suggested steps just to be on the safe side.
Referral Note: When you purchase through an referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer