Nginx内容编码似乎不适用于我的Next.js应用程序中的图像

Nginx内容编码似乎不适用于我的Next.js应用程序中的图像,nginx,gzip,next.js,content-encoding,Nginx,Gzip,Next.js,Content Encoding,我在我的nginx配置的服务器块中声明了以下内容,以服务于我的Next.js应用程序: location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header

我在我的nginx配置的服务器块中声明了以下内容,以服务于我的Next.js应用程序:

location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

    location ~* \.(?:ico|gif|jpg|jpeg|png)$ {
        expires 2d;
        add_header Pragma public;
        add_header Cache-Control "public";
    }
然后在我的nginx.conf中,我为gzip启用了以下功能:

gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon
但是,当我使用curl请求测试时,如中所示:

curl-H“接受编码:gzip”-I

我看不出:

内容编码:gzip

我得到的结果是:

HTTP/1.1 200 OK
Server: nginx/1.15.9 (Ubuntu)
Date: Thu, 30 Jan 2020 21:00:53 GMT
Content-Type: image/jpeg
Content-Length: 88193
Last-Modified: Thu, 30 Jan 2020 12:09:37 GMT
Connection: keep-alive
ETag: "5e32c781-15881"
Accept-Ranges: bytes

有人能帮我把这件事搞清楚吗/看是什么错了吗?

你确定gzip模块是为nginx安装的吗?我想是的,因为当我运行
curl-H“Accept Encoding:gzip”时-我https://sustainablelife.tips
它说
内容编码:gzip
nginx-V
显示
--带有-http\u gzip\u static\u模块
啊,我想这回答了这个问题:基本上图像没有被压缩