gzip apache
We can speed up the site with compression while save bandwidth at the same time. As most of the modern browsers support gzip encoding, we can set it up to let the users enjoy faster speed. The Apache mod_deflate is easy to set up and standard. It compress the content on the fly.
我们可以通过压缩来加速站点,同时节省带宽。 由于大多数现代浏览器都支持gzip编码,因此我们可以对其进行设置以使用户享受更快的速度。 Apache mod_deflate易于设置和标准化。 它动态压缩内容。
We can enable output compression in Apache by adding the following into the .htaccess file in the root directory of the website:
通过将以下内容添加到网站根目录中的.htaccess文件中,我们可以在Apache中启用输出压缩:
# Compress html, text, javascript, css and xml content:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/x-javascript
If the .htaccess file can’t be edited or the mode isn’t enabled, there is another alternative solution for php supported environment:
如果.htaccess文件无法编辑或未启用该模式,则可以使用另一种替代方法来解决php支持的环境:
Speeding Up the Site by Using PHP GZIP Compression
翻译自: https://www.systutorials.com/speeding-up-the-site-with-apache-gzip-compression/
gzip apache