1"use strict";(self.webpackChunkramisayar_staticsite=self.webpackChunkramisayar_staticsite||[]).push([[6639],{1257:function(e,t,a){a.r(t),a.d(t,{Head:function(){return m},default:function(){return p}});var n=a(9694),l=a(758);function r(e){const t=Object.assign({p:"p",a:"a",span:"span"},(0,n.RP)(),e.components);return l.createElement(l.Fragment,null,l.createElement(t.p,null,"Recently I started experimenting with the ",l.createElement(t.a,{href:"https://aws.amazon.com/",target:"_blank",rel:"nofollow noopener noreferrer"},"AWS")," fancy deployment system, ",l.createElement(t.a,{href:"https://aws.amazon.com/elasticbeanstalk/",target:"_blank",rel:"nofollow noopener noreferrer"},"Elastic Beanstalk"),". The first thing I noticed was that gzip (mod_deflate) compression was not enabled by default. A quick search revealed that it is indeed not enabled by default for reasons of compatibility."),"\n",l.createElement(t.p,null,"If you are running a web application (e.g. Django, RoR, etcâ¦) that separates out static resources and asks ",l.createElement(t.a,{href:"https://www.apache.org/",target:"_blank",rel:"nofollow noopener noreferrer"},"Apache")," to serve them directly, you can not rely on your web app to do the compression. We have to enable compression at the web server level in a way that will work even when Amazon updates the configurations files. Luckily, it seems that every Apache module underneath the sun is already preloaded, including mod_deflate. Also, the Elastic Beanstalk developers had the foresight to rely on the conf.d/ pattern for loading additional configuration files so that we do not have to mess with their httpd.conf file."),"\n",l.createElement(t.p,null,"Taking advantage of the .ebextensions configuration file, we can attach a command to copy over our mod_deflate configuration to the conf.d/ folder."),"\n",l.createElement(t.span,{dangerouslySetInnerHTML:{__html:'<div class="gatsby-highlight" data-language="text"><pre class="language-text"><code class="language-text">container_commands:\n 01_setup_apache:\n command: "cp enable_mod_deflate.conf /etc/httpd/conf.d"</code></pre></div>'}}),"\n",l.createElement(t.p,null,"Finally, this is the enable_mod_deflate.conf. Make sure the file is somewhere within your git repository and that you update the above path to reflect that. (Also ensure that the file extension is .conf or else Apache will not pick it up.)"),"\n",l.createElement(t.span,{dangerouslySetInnerHTML:{__html:'<div class="gatsby-highlight" data-language="text"><pre class="language-text"><code class="language-text"># mod_deflate configuration\n<IfModule mod_deflate.c>\n # Restrict compression to these MIME types\n AddOutputFilterByType DEFLATE text/plain\n AddOutputFilterByType DEFLATE text/html\n AddOutputFilterByType DEFLATE application/xhtml+xml\n AddOutputFilterByType DEFLATE text/xml\n AddOutputFilterByType DEFLATE application/xml\n AddOutputFilterByType DEFLATE application/xml+rss\n AddOutputFilterByType DEFLATE application/x-javascript\n AddOutputFilterByType DEFLATE text/javascript\n AddOutputFilterByType DEFLATE text/css\n AddOutputFilterByType DEFLATE image/png\n AddOutputFilterByType DEFLATE image/gif\n AddOutputFilterByType DEFLATE image/jpeg\n\n # Level of compression (Highest 9 - Lowest 1)\n DeflateCompressionLevel 9\n\n # Netscape 4.x has some problems.\n BrowserMatch ^Mozilla/4 gzip-only-text/html\n\n # Netscape 4.06-4.08 have some more problems\n BrowserMatch ^Mozilla/4\\.0[678] no-gzip\n\n # MSIE masquerades as Netscape, but it is fine\n BrowserMatch \\bMSI[E] !no-gzip !gzip-only-text/html\n\n <IfModule mod_headers.c>\n # Make sure proxies don\'t deliver the wrong content\n Header append Vary User-Agent env=!dont-vary\n </IfModule>\n</IfModule></code></pre></div>'}}),"\n",l.createElement(t.p,null,"There you have it; a fairly quick and easy way to automatically enable gzip compression on AWS Elastic Beanstalk without having to manually configure Apache or mess around with all the servers Elastic Beanstalk will instantiate (remember EB instances are meant to be ephemeral)."))}var o=function(e){void 0===e&&(e={});const t=Object.assign({},(0,n.RP)(),e.components).wrapper;return t?l.createElement(t,e,l.createElement(r,e)):r(e)},s=a(7854),i=a(3207),c=a(3623),u=a(2305);const d=e=>{let t=e.data.mdx,a=e.children;return l.createElement(s.A,null,l.createElement(i.A,{post:t},a))},m=e=>{let t=e.location,a=e.data;if(!a.mdx)return null;const n=(0,u.Q6)(),r=n.title,o=n.subtitle,s=a.mdx.frontmatter,i=s.title,d=s.description,m=null!==d?d:o,p=i+" - "+r;return l.createElement(c.A,{title:p,description:m,pathname:t.pathname})};function p(e){return l.createElement(d,e,l.createElement(o,e))}},3207:function(e,t,a){a.d(t,{A:function(){return p}});var n=a(758),l=a(5662),r=a(8173),o=a(2305);var s=()=>{const e=(0,o.Q6)().author;return n.createElement("div",{className:"Author-module--author--1c58d"},n.createElement("p",{dangerouslySetInnerHTML:{__html:e.bio}}),n.createElement("p",null,n.createElement("a",{className:"Author-module--author__bio-twitter--75212",href:(0,r.e)("twitter",e.contacts.twitter),rel:"noopener noreferrer",target:"_blank"},n.createElement("strong",null,e.name)," on Twitter")))};var i=e=>{let t=e.title,a=e.children;return n.createElement("div",{className:"Content-module--content--80d58"},n.createElement("h1",{className:"Content-module--content__title--f2408"},t),n.createElement("div",{className:"Content-module--content__body--0ce51"},a))},c=a(6343),u=a(6219);var d=e=>{let t=e.date;return n.createElement("div",null,n.createElement("p",{className:"Meta-module--meta__date--0c1b6"},"Published ",(0,c.GP)((0,u.H)(t),"d MMM yyyy")))};var m=e=>{let t=e.tags,a=e.tagSlugs;return n.createElement("div",{className:"Tags-module--tags--18589"},n.createElement("ul",{className:"Tags-module--tags__list--7df03"},a&&a.map((e,a)=>n.createElement("li",{className:"Tags-module--tags__list-item--a981e",key:t[a]},n.createElement(l.Link,{to:e,className:"Tags-module--tags__list-item-link--3ec2a"},t[a])))))};var p=e=>{let t=e.post,a=e.children;if(!t)return null;const r=t.fields.tagSlugs,o=t.frontmatter,c=o.tags,u=o.title,p=o.date;return n.createElement("div",null,n.createElement(l.Link,{className:"Post-module--post__home-button--c395c",to:"/"},"All Articles"),n.createElement("div",null,n.createElement(i,{title:u},a)),n.createElement("div",{className:"Post-module--post__footer--0bca4"},n.createElement(d,{date:p}),c&&r&&n.createElement(m,{tags:c,tagSlugs:r}),n.createElement(s,null)))}},9694:function(e,t,a){a.d(t,{RP:function(){return r}});var n=a(758);const l=n.createContext({});function r(e){const t=n.useContext(l);return n.useMemo(()=>"function"==typeof e?e(t):{...t,...e},[t,e])}}}]); 2//# sourceMappingURL=component---src-templates-post-template-js-content-file-path-content-posts-2012-10-08-howto-automatically-enable-gzip-compression-on-aws-elastic-beanstalk-md-0f53378857a8f0a1c23d.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.