Nginx静态文件压缩和代码压缩配置教程

宋子宪博客 2022-06-23 14:37:10 阅读数:193

代码nginx文件压缩静态

nginx静态资源动态压缩

nginx开启gzip压缩

server {
listen 80;
listen [::]:80;
server_name localhost;
server_tokens off;
# 开启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_types text/plain application/css text/css application/xml text/javascript application/javascript application/x-javascript;
#szxblog 前端
location /jxbp {
alias /usr/local/szxblog;
index index.html;
try_files $uri $uri/ /dist/index.html;
}
}

然后重启

nginx:nginx -s reload
版权声明:本文为[宋子宪博客]所创,转载请带上原文链接,感谢。 https://songzixian.com/linuxtool/1821.html