How to configure gzip compression on a web server?

I have a built-in web server on which there is only 2 megabytes. Usually you get gzip files for clients, but this will save us server space. I read that you can just gzip the js file and save it to the server. I tested this on IIS and I was not lucky at all. What exactly do I need to do at each stage of the process to make this work?

Here is what I think it will look like this:

  • gzip foo.js
  • change the link in html to point to foo.js.gz, not just .js
  • Add some headline to the response?

Thanks for any help.

-fREW

EDIT . My web server cannot do anything on the fly. This is not Apache or IIS; this is binary code on a ZiLog processor. I know that you can compress threads; I just heard that you can compress files once and leave them compressed.

+3
source share
3 answers

As already mentioned, mod_deflate does this for you, but I think you need to do it manually, as it is an embedded environment.

First of all, you should leave the name of the file foo.js after its gzip.

You should not change anything in your html files. Since the file is still foo.js

In the response header (gzipped) of foo.js you send the header

Content-Encoding: gzip

. foo.js Content-Encoding: gzip, gzipped , .

, , , gzip, , gzipped-,

Accept-Encoding: gzip
+5

gzip - - , .

+1

Apache, mod_deflate, .

, , , - gzip, . , , , , .

+1
source

Source: https://habr.com/ru/post/1698404/


All Articles