Apache + mod_deflate: serve pre-compressed content instead of deflating on each and every request, also serve webp if available.
This is a dump of a testing/beta apache vhost configuration that serves the following use-case:
- Instead of gzipping html, js and css on each and every request, create gzipped files and serve them directly, without having apache compress the same file over and over again for each and every request.
- index.html is requested, index.html.gz is being served instead.
- When requesting a image/jpeg or image/png AND the browser sends “Accept: …image/webp…” then serve the webp-file instead of the requested jpeg.
- foo.jpeg is requested, foo.jpeg.wep is being served.
- do some default caching-header stuff.
One can use some content generators, triggers or hooks on a website-generator/cms to create/compress those files once and save bandwith/cpu on each and every request. The downside is, that those additional file do need precious disk-space too…
This is the vhost: