使用之后有小伙伴觉的压缩效果不是特别理想,即便压缩等级调到5以上,那是因为宝塔 Nginx 环境 Gzip 压缩默认输出 MIME 类型很少。
Nginx修改Gzip配置
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
针对WordPress优化 Gzip 配置,为方便小伙伴们看清类别,以竖列形式展示,可直接复制到 Nginx 配置当中(宝塔在49行位置)。
gzip_types application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-font-opentype application/x-font-truetype application/x-javascript application/x-web-app-manifest+json application/xhtml+xml application/xml font/eot font/opentype font/otf image/svg+xml image/x-icon image/vnd.microsoft.icon text/css text/plain text/javascript text/x-component;
点击保存之后,重载 Nginx 配置,再重启下 Nginx 即可。如果有缓存(这里不确定缓存是否有影响,先做了再说),还可以清一波缓存!
© 版权声明
THE END