简体   繁体   English

如何知道nginx是否正在压缩gzip?

[英]how know if nginx is compressing gzip?

this is de config file of nginx 这是Nginx的配置文件

gzip on;
    gzip_disable "msie6";
        # gzip_static on;
    gzip_min_length 1400; 
        gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 9;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css image/png image/gif image/jpg application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript applicacion/x-font-ttf font/opentype application/x;

in the google analizer appears that the js files are not compressed, so i add to nodejs the gzippo module, this is the repo 在谷歌分析器中似乎没有压缩js文件,因此我将gzippo模块添加到nodejs,这是存储

 //app.use(express.static(path.join(__dirname, 'public')));
  app.use(gzippo.staticGzip(path.join(__dirname, 'public')));

when i add the module google says that js are gzipped, but in the repo doesnt say how can i add css files and images files to the gzippo module compression 当我添加模块时,谷歌说js已压缩,但是在仓库中却没有说我如何将css文件和图像文件添加到gzippo模块压缩中

so how can i know wich files are compressed with nginx or nodejs gzippo module, and how can i compress otf files??? 所以我怎么知道wich文件是用nginx或nodejs gzippo模块压缩的,我该如何压缩otf文件呢?

Partial answer: to know whether some resource is being compressed, open up your browser's Developer tools, Network panel, and do a complete reload of your webpage (usually Shift + Reload button.) If a resource is being correctly served in a compressed state, you will notice the Size and Content values differ: 部分答案:要知道是否正在压缩某些资源,请打开浏览器的“开发工具”,“网络”面板,并完全重新加载网页(通常是Shift + Reload按钮。)如果以压缩状态正确提供了资源,您会注意到“大小”和“内容”值有所不同:

屏幕截图

When using Firefox and Firebug, check the HTTP headers of a request. 使用Firefox和Firebug时,请检查请求的HTTP标头。 Click the Network tab and inspect a request. 单击网络选项卡,然后检查请求。 In the answer HTTP section, when a Content-Encoding gzip then your request was successfully compressing. 在答案HTTP部分中,当使用Content-Encoding gzip您的请求已成功压缩。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM