大网数据广告活动
网站运营与故障问答

Amazon EC2 Bitnami Wordpress Leverage Browser Caching

· 52CE 我爱测

Just setup a Wordpress site on an using an Amazon EC2 Bitnami AMI. I've ran the usual suspects of speed tests and have added this to my .htaccess file, like I've done dozens of times before: ## EXPIRES CACHING ## <IfModule mod_ex…

问题原文

原帖链接 · pee2pee · CC BY-SA 3.0

Just setup a Wordpress site on an using an Amazon EC2 Bitnami AMI. I've ran the usual suspects of speed tests and have added this to my .htaccess file, like I've done dozens of times before:

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##

However I still get the issues around saying I should leverage browser caching. Apache has restarted and even the server has been rebooted but same happens. I've checked the Apache2 config file and the mod_expires module is present (I'm 99% sure it is!)

Anything I'm missing that is maybe specific to Amazon EC2 and/or Bitnami Wordpress?

Standard Bitnami AMI... Linux version 3.13.0-100-generic

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 3.0

There appear to be two things you need to check.

First edit /opt/bitnami/apache2/conf/httpd.conf and make sure that the line loading mod_expires is not commented out (comments start with #). If it is, uncomment it and restart Apache. (source)

If you are trying to set the expires headers in .htaccess you will also have to allow overrides in your Apache configuration. Edit httpd.conf and make sure that allowoverride all is specified. (source)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。