Why do I need to enable Gzip?
A: After Gzip is enabled, the data output to the user's browser will be compressed to reduce the amount of data transmitted over the network and increase the browsing speed.
How to enable Gzip?
1. First find the httpd. conf file
For Linux servers
2. Enable the gzip function and load related modules:
The gzip function uses the mod_deflate.so module. The first step is to introduce the mod_deflate.so module:
First open the httpd. conf file, search for the mod_deflate.so line, and then remove the "#" comment symbol before the line.
LoadModuledeflate_modulemodules/mod_deflate.so
3. Configure gzip. Gzip files are common web files, such as js and css.
Add the following at the end of the configuration file:
<Ifmodulemod_deflate.c>
DeflateCompressionLevel6
AddOutputFilterDEFLATEhtmlxmljscssjpggifpng
</Ifmodule>
4. Restart Apache. Then go to the browser to test the effect. Below are some of my results:
Before optimization:
After optimization: