灵当CRM

 找回密码
 立即注册
查看: 3603|回复: 0

apache 开启JS和图片缓存

[复制链接]

1660

主题

1709

帖子

5万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
59079
 楼主| 发表于 2020-9-17 15:15:09 | 显示全部楼层 |阅读模式
修改 APACHE 配置文件 \ldcrm\apache\conf\httpd.conf

LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so

确认 APACHE 加载了以上两个模块(前面的注释符号 #  去掉),然后再在配置文件最后添加

<IfModule mod_expires.c>
        # 启用有效期控制
        ExpiresActive On
        # image
        ExpiresByType image/jpg "access plus 1 month"
        ExpiresByType image/jpeg "access plus 1 month"
        ExpiresByType image/gif "access plus 1 month"
        ExpiresByType image/png "access plus 1 month"
        ExpiresByType image/x-icon "access plus 1 month"
        # css/js
        ExpiresByType text/css "access plus 4 weeks"
        ExpiresByType text/javascript "access plus 4 weeks"
        # html
        ExpiresByType text/html "access plus 2 days"
</IfModule>

<IfModule mod_headers.c>
        # 配置mod_headers模块
        <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|woff|js|css|swf)$">
                Header set Cache-Control "max-age=604800"
                FileETag MTime Size
        </FilesMatch>
</IfModule>



重启apache 服务


apache 开启JS和图片缓存.txt (1.01 KB, 下载次数: 523)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

灵当CRM

GMT+8, 2024-3-29 16:48 , Processed in 0.053338 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2008-2022, Tencent Cloud.

沪ICP备08110973号-2

快速回复 返回顶部 返回列表