Apache2 mod_expires not working

I recently hosted a VPS website that supports Apache2, and worked on recommendations for improving performance from YSlow. Among these improvements, mod_deflate and mod_expires were used, and since I have root access, I can directly edit Apache configuration files.

mod_deflate now works, but I'm having problems with mod_expires, here is what I did:

enable expiration module and restart the server

a2enmod expires
service apache2 restart

create a new file "expires.conf" in the mods_enabled folder, which contains the following:

<IfModule mod_expires.c>
  # Enable expirations
  ExpiresActive On

  # Default directive
  ExpiresDefault "access plus 1 month"

  # My favicon
  ExpiresByType image/x-icon "access plus 1 year"

  # Images
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType image/jpg "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"

  # CSS
  ExpiresByType text/css "access plus 1 month"

  # Javascript
  ExpiresByType application/javascript "access plus 1 year"
</IfModule>

However, when checking in different Dev Tools browsers in the Network section, the files show Cache Control of None.

mod_expires script .htaccess, :/var/www/sitename/public_html, .htaccess , apache .

htaccess apache2.conf.

, htaccess , ( IfModule). 500. htaccess.

, dev - -, .

- ? !

+4
2

, , :

  • -, , : . , .

  • , apache2

0

, expires.conf expires, mods-enabled.

conf.d Apache.

0

Source: https://habr.com/ru/post/1613563/


All Articles