0

我有一个AWS弹性魔豆的应用:AWS弹性魔豆如何启用压缩

enter image description here

正如你所看到的,我跑在Tomcat Web服务器。

运行后Google PageSpeed Insights超过my website,我看到为了提高性能我需要启用压缩

我已阅读here,我需要将.ebextensions文件夹添加到我的根文件夹。哪里是?

我试过把它加到我的webapp文件夹中。那是对的吗?

enter image description here

我需要什么样的文件添加到该文件夹​​.ebextensions?那么,我只需通过仪表板将应用上传到AWS?

道歉,因为模糊不清,但你可以说,我在这里很无能。

UPDATE

我说这根:

.../main/webapp/.ebextensions/apache.config 

其中apache.config

files: 
    "/etc/httpd/conf.d/gzip.conf": 
    mode: "000644" 
    owner: root 
    group: root 
    content: | 
     <Location /> 
     # Insert filter!!! 
     SetOutputFilter DEFLATE 
     </Location> 

然而,当我测试它here,我得到:

enter image description here

+0

你想压缩以改善性能?你是在将数据写入S3还是你想压缩的东西? – notionquest

+0

我有一个静态网站,其中包含.svg,.png,.jpg,.css&,html,我想压缩其性能。 – Richard

+0

是否创建了'gzip.conf'文件? YML文件在空格时非常挑剔,所以在content:|行之后的双缩进可能会导致问题。 – Brian

回答

0

把的Cloudfront在EB实例的前面也是一种选择。

在行为设置“自动压缩对象”中有一个复选框可启用gzip压缩。