You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# vim /etc/nginx/conf.d/locations/kdadmin.conf
location / {
alias /home/admin/kdadmin/kada-admin/;
index index.html index.htm;
gzip_static off;#静态压缩 开启gizp
}
Vue 项目中如何开启 Gizp
系统环境
注意:
第一种方式
1.1 安装
compression-webpack-plugin
插件注意:
1.2 vue.config.js 配置compression-webpack-plugin插件
1.3 Nginx 配置 gzip
1.4 重新 reload Nginx 配置
这种模式需要前端工程打包生成 gzip,然后 Nginx 开始 gzip 相关配置
第二种方式纯 Nginx 配置
2.1 在 nginx.conf 文件夹的
http
里面配置数据2.2 重新 reload Nginx 配置
最终效果
未开启 gzip:
开启 gzip:
结语
阅读原文
The text was updated successfully, but these errors were encountered: