复制代码

为懒人提供无限可能,生命不息,code不止

人类感性的情绪,让我们知难行难
我思故我在
日拱一卒,功不唐捐
  • 首页
  • 前端
  • 后台
  • 数据库
  • 运维
  • 资源下载
  • 实用工具
  • 接口文档工具
  • 登录
  • 注册

nginx

【原创】nginx的gzip_static插件配合vue的gzip优化前端页面访问速度

作者: whooyun发表于: 2022-07-21 18:05

./configure --prefix=/opt/nginx-1.17.8 --with-http_stub_status_module  --with-pcre --with-http_rewrite_module --with-http_gzip_static_module --with-http_ssl_module

	gzip  on;
    gzip_min_length     1k;
    gzip_buffers        4 8k;
    #gzip_http_version   1.0;
    gzip_comp_level     8;
    gzip_proxied        any;
    gzip_types          text/plain application/javascript application/css  text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary           off;
    gzip_disable        "MSIE [1-6]\.";
    gzip_static         on;
nginx需要配置--with-http_gzip_static_module 插件,vue的.js.gz   .css.gz 即可在浏览器端解析访问,F12可观察到Content-Encoding:giz