Use Apachemod_expires to cache static files

Source: Internet
Author: User
Caching static files on the client not only improves the server response speed, but also reduces bandwidth and server load. Use apachemod_expire

Caching static files on the client not only improves the server response speed, but also reduces bandwidth and server load.
Apache mod_expires can be used to Cache static files. this mod_expires function mainly adds the max-age value of the Cache-Control header to the response header, which is used to set the Cache expiration time.
Setting method:
1. in the apache configuration file httpd. conf, find
# LoadModule expires_module modules/mod_expires.so remove #

2. Add configuration information:

ExpiresActive on # cache for ten days

ExpiresBytype text/css "access plus 10 days

ExpiresByType application/x-javascript "access plus 10 days"

ExpiresByType image/jpeg "access plus 10 days"


Expiresbytype image/gif "access plus 10 days"

3. restart apache.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.