当前位置:网站首页>Static resource compression reduces bandwidth pressure and increases access speed
Static resource compression reduces bandwidth pressure and increases access speed
2022-06-28 07:35:00 【Huangyuewang】
If the picture is too large and blurred after compression , It is recommended to use picture segmentation to show ;
1. Manual compression
Css/JS/IMG Achieve compressed address : On-line JS/CSS/HTML Compress
2.Maven Auto pack compression Automatic generation .min file
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent>
<dependencies>
<!-- SpringBoot Integrate Web Components -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<!-- Build related configurations -->
<build>
<!-- maven The plug-in configuration -->
<plugins>
<plugin>
<!-- YUI Compressor Maven Compression plug-ins -->
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<!-- Read js,css Document adoption UTF-8 code -->
<encoding>UTF-8</encoding>
<!-- No display js Possible errors -->
<jswarn>false</jswarn>
<!-- If there are compressed files , Will first compare the source file for changes . If there are changes, compress , No compression without change -->
<force>false</force>
<!-- Insert a new row after the specified column number -->
<linebreakpos>-1</linebreakpos>
<!-- Perform aggregate file operation before compressing -->
<preProcessAggregates>true</preProcessAggregates>
<!-- Save the file suffix after compression -->
<suffix>.min</suffix>
<!-- Source directory , That is, the root directory to be compressed -->
<sourceDirectory>${basedir}/mobile</sourceDirectory>
<!-- Compress js and css file -->
<includes>
<include>**/*.js</include>
<include>**/*.css</include>
</includes>
<!-- The following directories and files will not be compressed -->
<excludes>
<exclude>**/*.min.js</exclude>
<exclude>**/*.min.css</exclude>
<exclude>scripts/data/*.js</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
mvn yuicompressor:compress3.Nginx Built in compression
stay server With code inside
gzip on;
gzip_buffers 32 4K;
gzip_comp_level 6;
gzip_min_length 100;
gzip_types application/javascript text/css text/xml;
gzip_disable "MSIE [1-6]\."; # Configuration disable gzip Conditions , Support regular . Here said ie6 And below are not enabled gzip( because ie Lower version not supported )
gzip_vary on;
The instructions are as follows :
Details of the configuration file
gzip Common parameters of configuration
gzip on|off; # Open or not gzip
gzip_buffers 32 4K| 16 8K # buffer ( Compress to buffer several blocks in memory ? How big is each piece ?)
gzip_comp_level [1-9] # recommend 6 Compression level ( The higher the level , The smaller the pressure , More wasteful CPU Computing resources )
gzip_disable # Regular matching UA Like what? Uri Don't make gzip
gzip_min_length 200 # Minimum length to start compression ( No matter how small it is, don't compress it , The point is not )
gzip_http_version 1.0|1.1 # Start compressing http Protocol version ( You can leave it blank , Now it's almost all 1.1 agreement )
gzip_proxied # Set up the requester proxy , How to cache content
gzip_types text/plain application/xml # For which types of files to compress Such as txt,xml,html ,css
gzip_vary on|off # Whether to transmit gzip Compress logo test :
Direct port access

go nginx visit :
Compressed 4 More than double
边栏推荐
- R 语言 ggmap
- What should I do if the version is incompatible with the jar package conflict?
- Pfizer's new Guankou medicine has entered the Chinese market, and the listing of relevant products of domestic pharmaceutical enterprises is just around the corner
- open62541直接导入NodeSet文件
- DOM parsing of XML file case code sentence by sentence analysis
- flutter 实现摇一摇功能
- Reading notes - MySQL technology l act: InnoDB storage engine (version 2)
- What is a consistent hash? What scenarios can it be applied to?
- Force buckle 515 Find the maximum value in each tree row
- LeetCode+ 66 - 70 高精度、二分专题
猜你喜欢

Jinshan cloud team shared | 5000 words to understand how Presto matches with alluxio

Top 25 most popular articles on vivo Internet technology in 2021

Yesterday, I went to a large factory for an interview and asked me to do four arithmetic operations. Fortunately, I am smart enough

No suspense about the No. 1 Internet company overtime table

linux下修改mysql用户名root

Mysql57 zip file installation

MySQL installation steps - how to create a virtual machine under Linux (1)

GoLand IDE and delve debug Go programs in kubernetes cluster

Design and practice of vivo sensitive word matching system

剑指Offer||:链表(简单)
随机推荐
7-1 understand everything
一个小工具可以更快的写爬虫
R language drawing ggplot2 seasonal graph
Kubelet garbage collection (exiting containers and unused images) source code analysis
基金的投资交易与结算
An important term in MySQL -- CRUD
MySQL installation steps - how to create a virtual machine under Linux (1)
Huawei cloud computing physical node cna installation tutorial
Analyze 5 indicators of NFT project
Llvm and clang
XML序列化向后兼容
NDK cross compilation
Is it safe to open an account on Dongfang fortune
What is a consistent hash? What scenarios can it be applied to?
kubernetes部署thanos ruler的发送重复告警的一个隐秘的坑
看似简单的光耦电路,实际使用中应该注意些什么?
PLC -- Notes
Solving the longest palindrome substring by dynamic programming
R 语言 Kolmogorov-Smirnov 检验 2 个样本是否遵循相同的分布。
自动化测试的生命周期是什么?