AWS Elastic Beanstalk如何启用压缩

时间:2017-06-09 10:01:15

标签: amazon-web-services compression gzip elastic-beanstalk tomcat8

我有一个AWS Elastic Beanstalk应用程序:

enter image description here

如您所见,我在Tomcat上运行Web服务器。

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

我已阅读here我需要在我的根文件夹中添加.ebextensions文件夹。那是哪里?

我尝试将其添加到我的webapp文件夹中。这是对的吗?

enter image description here

我需要将哪些文件添加到此.ebextensions文件夹?那么我只是通过仪表板将应用程序上传到AWS吗?

道歉是模糊的,但正如你所知,我在这里很无能为力。

更新

我将此添加到根目录:

.../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

2 个答案:

答案 0 :(得分:0)

在上述情况下,根文件夹为jbosswildfly。它不应添加到webapps

Refer this link for webapps using tomcat

Bundling war file

enter image description here

答案 1 :(得分:0)

将Cloudfront放在EB实例前面也是一种选择。

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