在 HTTP server 上設定 Gzip 壓縮,可以將文字類型 (HTML, *.js, *.css) 的檔案大小減少約 90%,可以加速檔案的傳輸,在頻寬較小的環境下會特別明顯。
WordPress 的外掛,提供了一些建議使用 Gzip 壓縮的檔案類型,可參考:
gzip on;
gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon application/json application/vnd.ms-access video/webm application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics app
lication/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel;
注意:所有 MIME type 都要寫在同一行