采用.htaccess设置网站的压缩与缓存
原文标题:设置blog的缓存和压缩
在网站根目录下的.htaccess文件中添加以下代码
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
ExpiresByType application/x-shockwave-flash A2592000
ExpiresByType text/css A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/javascript A2592000
ExpiresByType text/javascript A2592000
ExpiresByType text/html A600
SetOutputFilter DEFLATE
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?txtcssjsphppl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
Header unset Last-ModifiedFileETag none
现在使用Firefox的YSlow插件,以Small Site or Blog标准测试的分数为99分,以YSlow2(V2)标准测试的分数为94分,被扣掉的几分主要是因为没有使用CDN。所以现在速度已经被优化到了极致。
赶快把它放到你的网站或blog根目录下的.htaccess文件里吧。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

OpenIV is a popular game modification tool, mainly used in the Grand Theft Auto (GTA) series of games. Although using mods can add new features and improve the experience to the game, sometimes we may need to delete installed mods for various reasons. This article will explain how to remove mods using OpenIV. First, make sure you have the OpenIV tools installed. For users who have not installed it, you can download it from the OpenIV official website (https://www.ope

One of the standout features ofCyberpunk 2077is path tracing, but it can put a heavy toll on performance. Even systems with reasonably capable graphics cards, such as the RTX 4080 (Gigabyte AERO OC curr. $949.99 on Amazon), struggle to offer a stable

Earlier this month, a YouTuber named HowToMen showcased the Rabbit R1 running Android. With this mod, the device that was originally meant to be less distracting than a phone got to function like one. That isn't a bad thing, though, as Rabbit didn't

Nginx turns on the Gzip compression function, which can compress the css, js, xml, and html files of the website during transmission, improve the access speed, and then optimize the performance of Nginx! Images, videos and other multimedia files and large files on the Web website are compressed due to compression The effect is not good, so there is no need to support compression for images. If you want to optimize, you can set the life cycle of the image to be longer and let the client cache it. After turning on the Gzip function, the Nginx server will compress the sent content, such as css, js, xml, html and other static resources according to the configured policy, so that the size of the content is reduced, and the user will process it before receiving the returned content. The compressed data is displayed to the customer. so

Dynamic compression Dynamic compression actually means that the nginx server compresses the compiled creation. You need to enable the following configuration in the http and https modules of nginx.conf: gzipon; #Enable gizo compression gzip_min_length1k; #gizp compression starting point, only if the file is larger than 1k Compression gzip_comp_level6;#The larger the compression level number, the smaller the compression, but the more performance consumption depends on the actual situation gzip_proxiedany;#Enabled when nginx is used as a reverse proxy. For details, see the official documentation: http://nginx.org/en/docs /http/ngx_http_gzip

When playing games such as Grand Theft Auto V, many players like to use Mods to increase the fun and playability of the game. As a well-known Mod management tool, OpenIV can simplify the Mod installation and management process. So, let’s take a look at how to add Mod to OpenIV. First, you need to make sure you have downloaded and installed OpenIV. It can be found on the official website of OpenIV (https://openiv.com/)

The Asus ROG Ally features a 40 Wh battery, which typically results in about two hours of runtime. On the Ally X, however, Asus upgraded the battery to 80 Wh, pushing the battery life to around four hours, depending on the TDP. iFixit came up with a

Preface gzip (gnu-zip) is a compression technology. After gzip compression, the page size can be reduced to 30% or even smaller than the original size. In this way, users will browse the page much faster. The gzip compressed page needs to be supported by both the browser and the server. It is actually server-side compression. After being transmitted to the browser, the browser decompresses and parses it. We don’t need to worry about the browser, because most current browsers support parsing gzip pages. Whether it is front-end or back-end, nginx is often used when deploying projects, and small projects often use a reverse proxy or something. Today I will be simple and direct and talk about one of the points - gzip. If there are any errors, please correct me. Generally used on the server side is u
