{"id":3807,"date":"2019-01-28T16:36:17","date_gmt":"2019-01-28T08:36:17","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=3807"},"modified":"2019-01-28T16:36:17","modified_gmt":"2019-01-28T08:36:17","slug":"linux-%e7%9a%84-gzip-%e5%8e%8b%e7%bc%a9","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=3807","title":{"rendered":"Linux \u7684 gzip \u538b\u7f29"},"content":{"rendered":"<p>\n\tgzip \u538b\u7f29\u975e\u5e38\u7684\u5e38\u89c1\uff0c\u6bd4\u5982\u5728\u6d4f\u89c8\u5668\u4e2d\uff0chttp \u534f\u8bae\u4e2d\uff0c\u90fd\u53ef\u4ee5\u770b\u5230 gzip \u7684\u8eab\u5f71\u3002\u5982\u679c\u662f\u5927\u6587\u4ef6\uff0c\u6211\u4eec\u538b\u7f29\u540e\u518d\u4e0b\u8f7d\uff0c\u4e0b\u8f7d\u65f6\u95f4\u53ef\u80fd\u5c31\u4f1a\u8282\u7701\u5f88\u591a\u3002\n<\/p>\n<p>\n\t\u5e38\u89c1\u7684 Tomcat\u3001Nginx \u7b49\u90fd\u6709 gzip \u538b\u7f29\uff0cLinux \u4e2d\u4e5f\u6709\u3002\u90a3\u4e48 gzip \u538b\u7f29\u5230\u7684\u600e\u4e48\u4f7f\u7528\u7684\u5462\uff1f\u6211\u4eec\u4e00\u8d77\u6765\u770b\u4e2a\u6559\u7a0b\uff01\n<\/p>\n<p>\n\tgzip \u547d\u4ee4 \u7528\u6765\u538b\u7f29\u6587\u4ef6\u3002gzip \u662f GNUzip \u7684\u7f29\u5199\uff0c\u6700\u65e9\u7528\u4e8e UNIX \u7cfb\u7edf\u7684\u6587\u4ef6\u538b\u7f29\u3002gzip \u662f\u4e2a\u4f7f\u7528\u5e7f\u6cdb\u7684\u538b\u7f29\u7a0b\u5e8f\uff0c\u6587\u4ef6\u7ecf\u5b83\u538b\u7f29\u8fc7\u540e\uff0c\u5176\u540d\u79f0\u540e\u9762\u4f1a\u591a\u51fa&ldquo;.gz&rdquo;\u6269\u5c55\u540d\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"gzip\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fzmdof1yipj20fg089wh4.jpg\" style=\"width: 556px;height: 297px\" \/>\n<\/p>\n<p>\n\tgzip \u662f\u5728 Linux \u7cfb\u7edf\u4e2d\u7ecf\u5e38\u4f7f\u7528\u7684\u4e00\u4e2a\u5bf9\u6587\u4ef6\u8fdb\u884c\u538b\u7f29\u548c\u89e3\u538b\u7f29\u7684\u547d\u4ee4\uff0c\u65e2\u65b9\u4fbf\u53c8\u597d\u7528\u3002gzip \u4e0d\u4ec5\u53ef\u4ee5\u7528\u6765\u538b\u7f29\u5927\u7684\u3001\u8f83\u5c11\u4f7f\u7528\u7684\u6587\u4ef6\u4ee5\u8282\u7701\u78c1\u76d8\u7a7a\u95f4\uff0c\u8fd8\u53ef\u4ee5\u548ctar\u547d\u4ee4\u4e00\u8d77\u6784\u6210 Linux \u64cd\u4f5c\u7cfb\u7edf\u4e2d\u6bd4\u8f83\u6d41\u884c\u7684\u538b\u7f29\u6587\u4ef6\u683c\u5f0f\u3002\u636e\u7edf\u8ba1\uff0cgzip \u547d\u4ee4\u5bf9\u6587\u672c\u6587\u4ef6\u6709 60%\uff5e70% \u7684\u538b\u7f29\u7387\u3002\u51cf\u5c11\u6587\u4ef6\u5927\u5c0f\u6709\u4e24\u4e2a\u660e\u663e\u7684\u597d\u5904\uff0c\u4e00\u662f\u53ef\u4ee5\u51cf\u5c11\u5b58\u50a8\u7a7a\u95f4\uff0c\u4e8c\u662f\u901a\u8fc7\u7f51\u7edc\u4f20\u8f93\u6587\u4ef6\u65f6\uff0c\u53ef\u4ee5\u51cf\u5c11\u4f20\u8f93\u7684\u65f6\u95f4\u3002\n<\/p>\n<h2>\n\t\u8bed\u6cd5\u683c\u5f0f<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\ngzip(\u9009\u9879)(\u53c2\u6570)<\/pre>\n<p>\n\t\u5176\u4e2d\u7684\u9009\u9879\u6709\u5f88\u591a\u503c\uff0c\u89e3\u91ca\u5982\u4e0b\uff1a\n<\/p>\n<ul>\n<li>\n\t\t-a\u6216&mdash;&mdash;ascii\uff1a\u4f7f\u7528ASCII\u6587\u5b57\u6a21\u5f0f\uff1b\n\t<\/li>\n<li>\n\t\t-d\u6216&#8211;decompress\u6216&#8212;-uncompress\uff1a\u89e3\u5f00\u538b\u7f29\u6587\u4ef6\uff1b\n\t<\/li>\n<li>\n\t\t-f\u6216&mdash;&mdash;force\uff1a\u5f3a\u884c\u538b\u7f29\u6587\u4ef6\u3002\u4e0d\u7406\u4f1a\u6587\u4ef6\u540d\u79f0\u6216\u786c\u8fde\u63a5\u662f\u5426\u5b58\u5728\u4ee5\u53ca\u8be5\u6587\u4ef6\u662f\u5426\u4e3a\u7b26\u53f7\u8fde\u63a5\uff1b\n\t<\/li>\n<li>\n\t\t-h\u6216&mdash;&mdash;help\uff1a\u5728\u7ebf\u5e2e\u52a9\uff1b\n\t<\/li>\n<li>\n\t\t-l\u6216&mdash;&mdash;list\uff1a\u5217\u51fa\u538b\u7f29\u6587\u4ef6\u7684\u76f8\u5173\u4fe1\u606f\uff1b\n\t<\/li>\n<li>\n\t\t-L\u6216&mdash;&mdash;license\uff1a\u663e\u793a\u7248\u672c\u4e0e\u7248\u6743\u4fe1\u606f\uff1b\n\t<\/li>\n<li>\n\t\t-n\u6216&#8211;no-name\uff1a\u538b\u7f29\u6587\u4ef6\u65f6\uff0c\u4e0d\u4fdd\u5b58\u539f\u6765\u7684\u6587\u4ef6\u540d\u79f0\u53ca\u65f6\u95f4\u6233\u8bb0\uff1b\n\t<\/li>\n<li>\n\t\t-N\u6216&mdash;&mdash;name\uff1a\u538b\u7f29\u6587\u4ef6\u65f6\uff0c\u4fdd\u5b58\u539f\u6765\u7684\u6587\u4ef6\u540d\u79f0\u53ca\u65f6\u95f4\u6233\u8bb0\uff1b\n\t<\/li>\n<li>\n\t\t-q\u6216&mdash;&mdash;quiet\uff1a\u4e0d\u663e\u793a\u8b66\u544a\u4fe1\u606f\uff1b\n\t<\/li>\n<li>\n\t\t-r\u6216&mdash;&mdash;recursive\uff1a\u9012\u5f52\u5904\u7406\uff0c\u5c06\u6307\u5b9a\u76ee\u5f55\u4e0b\u7684\u6240\u6709\u6587\u4ef6\u53ca\u5b50\u76ee\u5f55\u4e00\u5e76\u5904\u7406\uff1b\n\t<\/li>\n<li>\n\t\t-S\u6216&lt;\u538b\u7f29\u5b57\u5c3e\u5b57\u7b26\u4e32&gt;\u6216&#8212;-suffix&lt;\u538b\u7f29\u5b57\u5c3e\u5b57\u7b26\u4e32&gt;\uff1a\u66f4\u6539\u538b\u7f29\u5b57\u5c3e\u5b57\u7b26\u4e32\uff1b\n\t<\/li>\n<li>\n\t\t-t\u6216&mdash;&mdash;test\uff1a\u6d4b\u8bd5\u538b\u7f29\u6587\u4ef6\u662f\u5426\u6b63\u786e\u65e0\u8bef\uff1b\n\t<\/li>\n<li>\n\t\t-v\u6216&mdash;&mdash;verbose\uff1a\u663e\u793a\u6307\u4ee4\u6267\u884c\u8fc7\u7a0b\uff1b\n\t<\/li>\n<li>\n\t\t-V\u6216&mdash;&mdash;version\uff1a\u663e\u793a\u7248\u672c\u4fe1\u606f\uff1b\n\t<\/li>\n<li>\n\t\t-&lt;\u538b\u7f29\u6548\u7387&gt;\uff1a\u538b\u7f29\u6548\u7387\u662f\u4e00\u4e2a\u4ecb\u4e8e1~9\u7684\u6570\u503c\uff0c\u9884\u8bbe\u503c\u4e3a&ldquo;6&rdquo;\uff0c\u6307\u5b9a\u6108\u5927\u7684\u6570\u503c\uff0c\u538b\u7f29\u6548\u7387\u5c31\u4f1a\u6108\u9ad8\uff1b\n\t<\/li>\n<li>\n\t\t&#8211;best\uff1a\u6b64\u53c2\u6570\u7684\u6548\u679c\u548c\u6307\u5b9a&ldquo;-9&rdquo;\u53c2\u6570\u76f8\u540c\uff1b\n\t<\/li>\n<li>\n\t\t&#8211;fast\uff1a\u6b64\u53c2\u6570\u7684\u6548\u679c\u548c\u6307\u5b9a&ldquo;-1&rdquo;\u53c2\u6570\u76f8\u540c\u3002\n\t<\/li>\n<li>\n\t\t-num \u7528\u6307\u5b9a\u7684\u6570\u5b57num\u8c03\u6574\u538b\u7f29\u7684\u901f\u5ea6\uff0c-1\u6216&#8211;fast\u8868\u793a\u6700\u5feb\u538b\u7f29\u65b9\u6cd5\uff08\u4f4e\u538b\u7f29\u6bd4\uff09\uff0c-9\u6216&#8211;best\u8868\u793a\u6700\u6162\u538b\u7f29\u65b9\u6cd5\uff08\u9ad8\u538b\u7f29\u6bd4\uff09\u3002\u7cfb\u7edf\u7f3a\u7701\u503c\u4e3a6\u3002\n\t<\/li>\n<\/ul>\n<p>\n\t\u53c2\u6570\uff0c\u5c31\u662f\u6587\u4ef6\u5217\u8868\uff1a\u6307\u5b9a\u8981\u538b\u7f29\u7684\u6587\u4ef6\u5217\u8868\u3002\u53ef\u4ee5\u662f *\uff0c\u6587\u4ef6\u5939\uff0c\u6587\u4ef6\u7b49\u3002\n<\/p>\n<h2>\n\t\u53c2\u8003\u6587\u6863<br \/>\n<\/h2>\n<ul>\n<li>\n\t\t<a href=\"https:\/\/tools.ietf.org\/html\/rfc1952\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">RFC 1952 &#8211; GZIP file format specification version 4.3<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/tools.ietf.org\/html\/rfc1951\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">RFC 1951 &#8211; DEFLATE Compressed Data Format Specification version 1.3<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/zh.wikipedia.org\/wiki\/DEFLATE\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">DEFLATE &#8211; \u7ef4\u57fa\u767e\u79d1\uff0c\u81ea\u7531\u7684\u767e\u79d1\u5168\u4e66<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/zh.wikipedia.org\/wiki\/LZW\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">LZW &#8211; \u7ef4\u57fa\u767e\u79d1\uff0c\u81ea\u7531\u7684\u767e\u79d1\u5168\u4e66<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/zh.wikipedia.org\/wiki\/LZ77%E4%B8%8ELZ78\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">LZ77 &#8211; \u7ef4\u57fa\u767e\u79d1\uff0c\u81ea\u7531\u7684\u767e\u79d1\u5168\u4e66<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/cs.stanford.edu\/people\/eroberts\/courses\/soco\/projects\/2000-01\/data-compression\/lossless\/lz77\/algorithm.htm\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">Standford Edu. lz77 algorithm<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/ee916854.aspx?f=255&amp;MSPPError=-2147217396\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">LZ77 Compression Algorithm<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/www.cnblogs.com\/junyuhuang\/p\/4138376.html\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">LZ77\u538b\u7f29\u7b97\u6cd5\u7f16\u7801\u539f\u7406\u8be6\u89e3(\u7ed3\u5408\u56fe\u7247\u548c\u7b80\u5355\u4ee3\u7801)<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E9%9C%8D%E5%A4%AB%E6%9B%BC%E7%BC%96%E7%A0%81\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">\u970d\u592b\u66fc\u7f16\u7801 &#8211; \u7ef4\u57fa\u767e\u79d1\uff0c\u81ea\u7531\u7684\u767e\u79d1\u5168\u4e66<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/blog.csdn.net\/imquestion\/article\/details\/16439\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">gzip\u539f\u7406\u4e0e\u5b9e\u73b0<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"http:\/\/nginx.org\/en\/docs\/http\/ngx_http_gzip_module.html\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">Module ngx_http_gzip_module<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/serverfault.com\/questions\/253074\/what-is-the-best-nginx-compression-gzip-level\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">What is the best nginx compression gzip level? <\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/developer.mozilla.org\/zh-CN\/docs\/Web\/HTTP\/Basics_of_HTTP\/MIME_types\/Complete_list_of_MIME_types\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">MDN &#8211; \u5b8c\u6574\u7684MIME\u7c7b\u578b\u5217\u8868<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/zhuanlan.zhihu.com\/p\/24764131\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">\u4f60\u771f\u7684\u4e86\u89e3 gzip \u5417\uff1f<\/a>\n\t<\/li>\n<\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=3807\">Linux \u7684 gzip \u538b\u7f29<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>gzip \u538b\u7f29\u975e\u5e38\u7684\u5e38\u89c1\uff0c\u6bd4\u5982\u5728\u6d4f\u89c8\u5668\u4e2d\uff0chttp \u534f\u8bae\u4e2d\uff0c\u90fd\u53ef\u4ee5\u770b\u5230 gzip \u7684\u8eab\u5f71\u3002\u5982\u679c\u662f\u5927\u6587\u4ef6\uff0c\u6211\u4eec\u538b [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[118,6],"tags":[1323,706,1394,1152,112],"class_list":["post-3807","post","type-post","status-publish","format-standard","hentry","category-ndisdevelop","category-yyzt","tag-js","tag-linux","tag-nginx","tag-tomcat"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3807"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3807\/revisions"}],"predecessor-version":[{"id":3808,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3807\/revisions\/3808"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}