Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Apache configure static cache

Shulou Source: shulou.com Published: 2022-06-01 05:31:42 10月04日 Update

Once configured, visitors can apply for cache to speed up the time for re-access. The configuration code is as follows:

Vim / usr/local/apache2/conf/extra/httpd-vhosts.conf

The following information is added to the module:

ExpiresActive on

ExpiresByType p_w_picpath/gif "access plus 1 days"

ExpiresByType p_w_picpath/jpeg "access plus 24 hours"

ExpiresByType p_w_picpath/png "access plus 24 hours"

ExpiresByType text/css "now plus 2 hours"

ExpiresByType application/x-javascript "now plus 2 hours"

ExpiresByType application/x-shockwave-flash "now plus 2 hours"

ExpiresDefault "now plus 0 min"

Save exit

Apachectl-t

Apachectl graceful

Test the configuration:

Curl-x127.0.0.1 purl 80 'https://cache.yisu.com/upload/information/20200311/71/163145.jpg'-I

Tags: Configuration caching code information again time module visitor test static Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Redmi Linux NVidia Shulou Information