Nginx static file compression and code compression configuration tutorial

Songzixian blog 2022-06-23 15:16:21 阅读数:221


nginx Static resource dynamic compression

nginx Turn on gzip Compress

server {
listen 80;
listen [::]:80;
server_name localhost;
server_tokens off;
# Turn on gzip Compress
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 front end
location /jxbp {
alias /usr/local/szxblog;
index index.html;
try_files $uri $uri/ /dist/index.html;

And then restart

nginx:nginx -s reload
版权声明:本文为[Songzixian blog]所创,转载请带上原文链接,感谢。