How to add expire header on Ubuntu with Apache2 :
Edit your httpd.conf
- The module ‘mod_expires’ must be activated
- Add the new configuration
1) Activate mod_expires
sudo a2enmod expires sudo /etc/init.d/apache2 restart
2) Add new lines on your httpd.conf
nano /etc/apache2/apache2.conf
Then add these lines at the end
ExpiresActive On
ExpiresByType image/gif “access 1 month”
ExpiresByType image/jpg “access 1 month”
ExpiresByType image/jpeg “access 1 month”
ExpiresByType image/png “access 1 month”
ExpiresByType text/css “access 1 month”
ExpiresByType text/js “access 1 week”
ExpiresByType application/javascript “access 1 week”
the restart
sudo /etc/init.d/apache2 restart