Nginx cannot compress javascript

various configurations of browsers and servers can be matched. But css, png can be compressed, but not javascript.

nginx for windows 1.12

Environment:
not even HTTP Request by Chrome / Opera browsers:

clipboard.png

NGINX SERVER:
nginx.conf:


mime.types:

clipboard.png

< hr > < H2 > New Discovery: < / H2 >

I tested three different computers and found that only my laptop (win7-64) could not receive gzip. The browsers on the other two js, (Aliyun windows 2008 server) could support js compression. It seems to have nothing to do with the browser type.

it is not clear why.

< H2 > continuous updates: < / H2 >

Local and remote servers have the same version of Opera, installed respectively. As a result, the native machine (win7 64) cannot receive compressed js,. Another machine, (windows server 2008 64), can.
is therefore thought to be caused by lower-level environmental differences.

Mar.12,2021

try the following settings:

gzip_types    text/plain application/javascript application/x-javascript text/javascript text/xml text/css;

it is said that the most supported js in browsers is text/javascript.

reference:

https://stackoverflow.com/que.


upgrade to nginx 1.14, the problem persists. Mark .

Menu