{"id":620,"date":"2021-06-30T16:24:51","date_gmt":"2021-06-30T09:24:51","guid":{"rendered":"https:\/\/doc.dncloud.net\/?p=620"},"modified":"2023-07-13T16:19:19","modified_gmt":"2023-07-13T09:19:19","slug":"huong-dan-bat-nen-gzip","status":"publish","type":"post","link":"https:\/\/dncloud.net\/blog\/huong-dan-bat-nen-gzip\/","title":{"rendered":"H\u01b0\u1edbng d\u1eabn b\u1eadt n\u00e9n Gzip"},"content":{"rendered":"<p>Trong b\u00e0i vi\u1ebft n\u00e0y m\u00ecnh s\u1ebd h\u01b0\u1edbng d\u1eabn b\u1ea1n b\u1eadt t\u00ednh n\u0103ng n\u00e9n GZIP cho trang web c\u1ee7a m\u00ecnh. Gzip Compression l\u00e0 ph\u01b0\u01a1ng ph\u00e1p n\u00e9n l\u00e0m gi\u1ea3m dung l\u01b0\u1ee3ng d\u1eef li\u1ec7u \u1edf server khi g\u1eedi \u0111\u1ebfn client gi\u00fap ti\u1ebft ki\u1ec7m b\u0103ng th\u00f4ng, t\u0103ng t\u1ed1c \u0111\u1ed9 t\u1ea3i c\u1ee7a website.<\/p>\n<p>B\u1eadt n\u00e9n Gzip kh\u00f4ng kh\u00f3 ch\u00fat n\u00e0o!&nbsp;T\u1ea5t c\u1ea3 nh\u1eefng g\u00ec b\u1ea1n c\u1ea7n l\u00e0m l\u00e0 th\u00eam \u0111o\u1ea1n m\u00e3 sau v\u00e0o t\u1ec7p .htaccess tr\u00ean trang web c\u1ee7a b\u1ea1n:<\/p>\n<pre> # Compress HTML, CSS, JavaScript, Text, XML and fonts\n AddOutputFilterByType DEFLATE application\/javascript\n AddOutputFilterByType DEFLATE application\/rss+xml\n AddOutputFilterByType DEFLATE application\/vnd.ms-fontobject\n AddOutputFilterByType DEFLATE application\/x-font\n AddOutputFilterByType DEFLATE application\/x-font-opentype\n AddOutputFilterByType DEFLATE application\/x-font-otf\n AddOutputFilterByType DEFLATE application\/x-font-truetype\n AddOutputFilterByType DEFLATE application\/x-font-ttf\n AddOutputFilterByType DEFLATE application\/x-javascript\n AddOutputFilterByType DEFLATE application\/xhtml+xml\n AddOutputFilterByType DEFLATE application\/xml\n AddOutputFilterByType DEFLATE font\/opentype\n AddOutputFilterByType DEFLATE font\/otf\n AddOutputFilterByType DEFLATE font\/ttf\n AddOutputFilterByType DEFLATE image\/svg+xml\n AddOutputFilterByType DEFLATE image\/x-icon\n AddOutputFilterByType DEFLATE text\/css\n AddOutputFilterByType DEFLATE text\/html\n AddOutputFilterByType DEFLATE text\/javascript\n AddOutputFilterByType DEFLATE text\/plain\n AddOutputFilterByType DEFLATE text\/xml\n\n# Remove browser bugs (only needed for really old browsers)\n BrowserMatch ^Mozilla\/4 gzip-only-text\/html\n BrowserMatch ^Mozilla\/4.0[678] no-gzip\n BrowserMatch bMSIE !no-gzip !gzip-only-text\/html\n Header append Vary User-Agent\n<\/pre>\n<p>B\u1ea1n ch\u1ec9 c\u1ea7n th\u00eam v\u00e0o \u0111o\u1ea1n m\u00e3 tr\u00ean v\u00e0 l\u01b0u l\u1ea1i trong file .htaccess v\u1eady l\u00e0 b\u1ea1n \u0111\u00e3 b\u1eadt th\u00e0nh c\u00f4ng t\u00ednh n\u0103ng n\u00e9n gzip. \u0110\u1ec3 ki\u1ec3m tra b\u1ea1n \u0111\u00e3 b\u1eadt Gzip hay ch\u01b0a b\u1ea1n h\u00e3y ki\u1ec3m tra v\u1edbi <a href=\"https:\/\/www.giftofspeed.com\/gzip-test\/\" target=\"_blank\" rel=\"noopener\">c\u00f4ng c\u1ee5 n\u00e0y.<\/a><\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-627 size-full\" src=\"https:\/\/dncloud.net\/blog\/wp-content\/smush-webp\/gzip-enable-1.png.webp\" alt=\"Gzip \u0111\u00e3 \u0111\u01b0\u1ee3c b\u1eadt\" width=\"825\" height=\"531\" data-smush-webp-fallback=\"{&quot;src&quot;:&quot;https:\\\/\\\/dncloud.net\\\/blog\\\/wp-content\\\/uploads\\\/gzip-enable-1.png&quot;}\"><\/p>\n<p>N\u1ebfu Gzip \u0111\u01b0\u1ee3c b\u1eadt k\u1ebft qu\u1ea3 s\u1ebd nh\u01b0 \u1ea3nh tr\u00ean.<\/p>\n<p><span>N\u1ebfu b\u1ea1n l\u00e0 kh\u00e1ch h\u00e0ng c\u1ee7a DNCLOUD, ch\u00fang t\u00f4i s\u1ebd gi\u00fap b\u1ea1n. T\u00ednh n\u0103ng n\u00e9n Brotli (Brotli c\u0169ng gi\u1ed1ng nh\u01b0 Gzip nh\u01b0ng n\u00f3 kh\u00f4ng l\u00e0m m\u1ea5t d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c n\u00e9n LZ77 \u1ed5n \u0111\u1ecbnh v\u00e0 nhanh h\u01a1n Gzip) \u0111\u01b0\u1ee3c b\u1eadt theo m\u1eb7c \u0111\u1ecbnh tr\u00ean t\u1ea5t c\u1ea3 <\/span><strong><a href=\"https:\/\/dncloud.net\" target=\"_blank\" rel=\"noopener\"><span>Hosting<\/span><\/a>&nbsp;<\/strong><span>c\u1ee7a ch\u00fang t\u00f4i&nbsp;.<\/span><\/p>\n<p>Ch\u00fac b\u1ea1n th\u00e0nh c\u00f4ng.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Trong b\u00e0i vi\u1ebft n\u00e0y m\u00ecnh s\u1ebd h\u01b0\u1edbng d\u1eabn b\u1ea1n b\u1eadt t\u00ednh n\u0103ng n\u00e9n GZIP cho trang&hellip;<\/p>\n","protected":false},"author":1,"featured_media":627,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[136,137,127],"tags":[145,168],"class_list":["post-620","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cpanel","category-directadmin","category-huong-dan-hosting","tag-brotli","tag-gzip"],"_links":{"self":[{"href":"https:\/\/dncloud.net\/blog\/wp-json\/wp\/v2\/posts\/620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dncloud.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dncloud.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dncloud.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dncloud.net\/blog\/wp-json\/wp\/v2\/comments?post=620"}],"version-history":[{"count":0,"href":"https:\/\/dncloud.net\/blog\/wp-json\/wp\/v2\/posts\/620\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dncloud.net\/blog\/wp-json\/wp\/v2\/media\/627"}],"wp:attachment":[{"href":"https:\/\/dncloud.net\/blog\/wp-json\/wp\/v2\/media?parent=620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dncloud.net\/blog\/wp-json\/wp\/v2\/categories?post=620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dncloud.net\/blog\/wp-json\/wp\/v2\/tags?post=620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}