当前位置:网站首页>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
边栏推荐
- hack the box:RouterSpace题解
- An important term in MySQL -- CRUD
- Construction and exploration of vivo database and storage platform
- kubernetes部署thanos ruler的发送重复告警的一个隐秘的坑
- R 语言绘制 动画气泡图
- NDK cross compilation
- [thanos source code analysis series]thanos query component source code analysis
- Evolution of vivo push platform architecture
- HTTP Caching Protocol practice
- Kubelet garbage collection (exiting containers and unused images) source code analysis
猜你喜欢

A gadget can write crawlers faster

以动态规划的方式求解最长回文子串

2021 VDC: technological architecture evolution of vivo Internet service for 100 million users | PPT download attached

Kubelet garbage collection (exiting containers and unused images) source code analysis

Modifying MySQL user name root under Linux

kubernetes部署thanos ruler的发送重复告警的一个隐秘的坑

Jetpack - defects of livedata component and Countermeasures

卸载重装最新版mysql数据库亲测有效

2021 programming language ranking summary

No suspense about the No. 1 Internet company overtime table
随机推荐
The practice of traffic and data isolation in vivo Reviews
Code submission specification
Unity-UI-shadow组件
What is a consistent hash? What scenarios can it be applied to?
Force buckle 515 Find the maximum value in each tree row
7-1 understand everything
Implementation of commit message standardized control in large projects
XML序列化向后兼容
golang gin框架进行分块传输
看似简单的光耦电路,实际使用中应该注意些什么?
Cloud native (to be updated)
Makefile
安全培训是员工最大的福利!2022新员工入职安全培训全员篇
Sword finger offer II 091 Paint the house
东方财富上开户是安全的吗
7-2 芬兰木棋 结构体排序
Understanding of OPC protocol
Makefile
小小一款代码编辑器竟然也可以有程序运行之功能——Sublime Text3运行各种语言程序的总结
R language ggmap visual cluster