Apache

.htaccess

<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|txt|swf|pdf|swf|js)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>

nginx

 location ~ \.(jpg|jpeg|png|gif)$ {
                    expires 365d;
                }

当然你也可以配置nginx支持.htaccess

Last modification:June 17, 2020
如果觉得我的文章对你有用,请随意赞赏