简体   繁体   中英

AWS Elastic Beanstalk How to enable compression

I have an AWS Elastic Beanstalk application:

在此处输入图片说明

As you can see, I am running a Web Server on Tomcat.

After running Google PageSpeed Insights over my website , I see in order to improve performance I need to Enable compression .

I have read here that I need to add a .ebextensions folder to my root folder. Where is that?

I have tried adding it to my webapp folder. Is that correct?

在此处输入图片说明

What files do I need to add to this .ebextensions folder? Then do I just upload the app to AWS via the dashboard?

Apologies for being vague, but as you can tell, I am pretty clueless here.

UPDATE

I added this to the root:

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

where apache.config :

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

However, when I test it here , I get:

在此处输入图片说明

The root folder is jbosswildfly in the above case. It shouldn't be added to webapps .

Refer this link for webapps using tomcat

Bundling war file

在此处输入图片说明

Putting Cloudfront in front of your EB instance is also an option.

There is a checkbox in the behavior settings "Compress Objects Automatically" to enable gzip compression.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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