简体   繁体   English

如何在Amazon S3存储桶中缓存php / static页面?

[英]How to cache php / static page in Amazon S3 bucket?

I have installed one WordPress site on my ec2 instance and already store and access all the images on Amazon S3 Bucket with the offload S3 plugin. 我已在我的ec2实例上安装了一个WordPress网站,并已通过卸载S3插件存储和访问Amazon S3 Bucket上的所有图像。 I want to make page cache of all the PHP page. 我想对所有PHP页面进行页面缓存。 Is it any mechanism or plugin available for this? 是否有任何可用的机制或插件?

I have referred this document for reference. 我已将此文件作为参考。

Since wordpress uses PHP to generate pages, you can't use S3 to cache them. 由于wordpress使用PHP生成页面,因此您不能使用S3来缓存它们。

However, you have a couple of options if the goal is to speed up your site. 但是,如果目标是加快网站速度,则有两种选择。

Option 1 is to use CloudFront, a CDN, in front of your site. 选项1是在站点前面使用CloudFront(CDN)。 This would require you to cache the generated pages for a certain timeframe, which means if you do update content, it will not show up for your end users immediately unless you invalidate the cloudfront cache. 这将需要您在特定时间范围内缓存生成的页面,这意味着如果您确实更新了内容,除非使Cloudfront缓存无效,否则不会立即为最终用户显示。

Option 2 is to export the entire site to static pages, and serve those out of S3. 选项2是将整个站点导出到静态页面,并为S3之外的页面提供服务。 The benefit of this is that it will be much cheaper to host your site; 这样做的好处是托管您的站点会便宜得多。 the downside is that you will have to refresh the S3 content every time you make a change. 缺点是每次进行更改时都必须刷​​新S3内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM