{"id":3803,"date":"2019-01-28T15:08:25","date_gmt":"2019-01-28T07:08:25","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=3803"},"modified":"2019-01-28T15:08:25","modified_gmt":"2019-01-28T07:08:25","slug":"nginx-autoindex%e8%ae%be%e7%bd%ae%e7%9b%ae%e5%bd%95%e6%b5%8f%e8%a7%88%e5%92%8c%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98%e8%a7%a3%e5%86%b3%e4%bb%a5%e5%8f%8aautoindex%e7%be%8e%e5%8c%96","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=3803","title":{"rendered":"nginx autoindex\u8bbe\u7f6e\u76ee\u5f55\u6d4f\u89c8\u548c\u4e71\u7801\u95ee\u9898\u89e3\u51b3\u4ee5\u53caautoindex\u7f8e\u5316"},"content":{"rendered":"<p>\n\t\u5f88\u591a\u4eba\u53ef\u80fd\u6ca1\u6709\u7528\u8fc7 nginx \u7684 autoindex \u529f\u80fd\u3002\u4f46\u662f\uff0c\u6211\u76f8\u4fe1\u5927\u5bb6\u90fd\u7528\u8fc7\u4e00\u4e9b\u7f51\u7ad9\u7684\u76ee\u5f55\u6d4f\u89c8\u529f\u80fd\u3002\u54ce\uff0c\u4e3a\u4ec0\u4e48\u6709\u7684 Nginx \u80fd\u4f7f\u7f51\u7ad9\u6309\u7167\u7f51\u9875\u7684\u5f62\u5f0f\u6d4f\u89c8\uff0c\u800c\u6709\u7684\u7f51\u7ad9\u5219\u663e\u793a\u7684\u662f\u6309\u7167\u76ee\u5f55\u6d4f\u89c8\uff1f\u8fd9\u662f\u4e3a\u4ec0\u4e48\uff1f\u4eca\u5929\u6211\u4eec\u4e00\u8d77\u6765\u5b66\u4e60\u5b66\u4e60 nginx \u4e2d\u7684 autoindex \u6307\u4ee4\u3002\n<\/p>\n<p>\n\tautoindex \u6307\u4ee4\u7684\u9ed8\u8ba4\u503c\u662f off\uff0c\u5b83\u5b58\u5728\u4e8e ngx_http_autoindex_module \u6a21\u5757\u4e2d\u3002\u5982\u679c\u6211\u4eec\u8bbe\u7f6e\u4e3a on\uff0c\u5219\u4ee3\u8868\u6211\u4eec\u5c06\u4ee5\u76ee\u5f55\u7684\u5f62\u5f0f\u5c55\u73b0\u7ed9\u7528\u6237\u3002autoindex \u6307\u4ee4\u53ef\u4ee5\u914d\u7f6e\u5728 http \u6307\u4ee4\u5757\u6216 location \u6307\u4ee4\u5757\u4e2d\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nlocation \/down\/ {\r\n  autoindex on;\r\n}<\/pre>\n<p>\n\t<img decoding=\"async\" alt=\"nginx autoindex\u8bbe\u7f6e\u76ee\u5f55\u6d4f\u89c8\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fzmb8r0gn6j20g30dmmze.jpg\" style=\"width: 579px;height: 490px\" \/>\n<\/p>\n<p>\n\t\u53e6\u5916 Nginx \u7684\u76ee\u5f55\u6d4f\u89c8\u8fd8\u6709\u51e0\u4e2a\u6bd4\u8f83\u6709\u7528\u7684\u53c2\u6570\uff0c\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u6dfb\u52a0\uff1a\n<\/p>\n<ul>\n<li>\n\t\tautoindex_exact_size off; \u9ed8\u8ba4\u4e3a on\uff0c\u663e\u793a\u51fa\u6587\u4ef6\u7684\u786e\u5207\u5927\u5c0f\uff0c\u5355\u4f4d\u662f bytes\u3002\u6539\u4e3a off \u540e\uff0c\u663e\u793a\u51fa\u6587\u4ef6\u7684\u5927\u6982\u5927\u5c0f\uff0c\u5355\u4f4d\u662f kB \u6216\u8005 MB \u6216\u8005 GB\u3002\n\t<\/li>\n<li>\n\t\tautoindex_localtime on; \u9ed8\u8ba4\u4e3a off\uff0c\u663e\u793a\u7684\u6587\u4ef6\u65f6\u95f4\u4e3a GMT \u65f6\u95f4\u3002\u6539\u4e3a on \u540e\uff0c\u663e\u793a\u7684\u6587\u4ef6\u65f6\u95f4\u4e3a\u6587\u4ef6\u7684\u670d\u52a1\u5668\u65f6\u95f4\u3002\n\t<\/li>\n<li>\n\t\tautoindex_format html; \u9ed8\u8ba4\u4e3a html\u3002\u4ee5\u7f51\u9875\u7684\u98ce\u683c\u5c55\u793a\u76ee\u5f55\u5185\u5bb9\u3002\u8be5\u5c5e\u6027\u57281.7.9\u53ca\u4ee5\u4e0a\u9002\u7528\u3002\n\t<\/li>\n<\/ul>\n<p>\n\t<img decoding=\"async\" alt=\"ngx_http_autoindex_module \u5e38\u89c1\u6307\u4ee4\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fzmb9s1sgmj20n30czq57.jpg\" style=\"width: 831px;height: 467px\" \/>\n<\/p>\n<h2>\n\tautoindex \u4e2d\u6587\u4e71\u7801\u95ee\u9898<br \/>\n<\/h2>\n<p>\n\t\u7fa4\u91cc\u6709\u5f88\u591a\u4eba\u53cd\u6620\u4f7f\u7528 autoindex \u6307\u4ee4\uff0c\u9047\u5230\u4e2d\u6587\u4f1a\u4ea7\u751f\u4e71\u7801\u3002\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u6211\u4eec\u53ea\u9700\u8981\u914d\u7f6e\uff1acharset utf-8,gbk; \u6307\u4ee4\u5373\u53ef\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nlocation \/download {\r\n    root \/home\/map\/www\/; #\u6307\u5b9a\u76ee\u5f55\u6240\u5728\u8def\u5f84\r\n    autoindex on; #\u5f00\u542f\u76ee\u5f55\u6d4f\u89c8\r\n    autoindex_format html; #\u4ee5html\u98ce\u683c\u5c06\u76ee\u5f55\u5c55\u793a\u5728\u6d4f\u89c8\u5668\u4e2d\r\n    autoindex_exact_size off; #\u5207\u6362\u4e3a off \u540e\uff0c\u4ee5\u53ef\u8bfb\u7684\u65b9\u5f0f\u663e\u793a\u6587\u4ef6\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a KB\u3001MB \u6216\u8005 GB\r\n    autoindex_localtime on; #\u4ee5\u670d\u52a1\u5668\u7684\u6587\u4ef6\u65f6\u95f4\u4f5c\u4e3a\u663e\u793a\u7684\u65f6\u95f4\r\n    charset utf-8,gbk; #\u5c55\u793a\u4e2d\u6587\u6587\u4ef6\u540d\r\n}<\/pre>\n<h2>\n\tautoindex \u76ee\u5f55\u7f8e\u5316<br \/>\n<\/h2>\n<p>\n\t\u76ee\u5f55\u7f8e\u5316\u8fd9\u4e2a\u64cd\u4f5c\u7a0d\u5fae\u9ebb\u70e6\u4e00\u70b9\u3002\u7a0d\u5fae\u4e0d\u5c0f\u5fc3\uff0c\u53ef\u80fd\u5c31\u4f1a\u51fa\u9519\u3002\u6309\u7167\u6211\u7684\u6b65\u9aa4\u6765\u5373\u53ef\uff01\n<\/p>\n<p>\n\t\u9996\u5148\uff0c\u4e0b\u8f7d\u5b89\u88c5 fancy\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"autoindex \u76ee\u5f55\u7f8e\u5316\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fzmbbqy8mbj20iu039wf8.jpg\" \/>\n<\/p>\n<p>\n\t\u7136\u540e\uff0cfancy \u7d22\u5f15\u914d\u7f6e\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nserver {\r\n  listen 80;\r\n  server_name test.xttblog.com;\r\n  access_log \/data\/logs\/nginx\/test.ttlsa.com.access.log main;\r\n  index index.html index index.html;\r\n  root \/data\/site\/xttblog.ttlsa.com;\r\n\r\n  location \/ {\r\n  }\r\n\r\n  location ~ ^\/2589(\/.*){\r\n    fancyindex on;\r\n    fancyindex_exact_size off;\r\n    fancyindex_localtime on;\r\n    fancyindex_footer &quot;myfooter.shtml&quot;;\r\n  }\r\n}<\/pre>\n<p>\n\t\u7136\u540e\u91cd\u542f Nginx \u5373\u53ef\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"autoindex \u76ee\u5f55\u7f8e\u5316\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fzmbcmlif4j20je0a3dgm.jpg\" style=\"width: 698px;height: 363px\" \/>\n<\/p>\n<p>\n\t\u8fd0\u884c\u6548\u679c\u5982\u4e0a\u6240\u793a\u3002<\/p>\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=3803\">nginx autoindex\u8bbe\u7f6e\u76ee\u5f55\u6d4f\u89c8\u548c\u4e71\u7801\u95ee\u9898\u89e3\u51b3\u4ee5\u53caautoindex\u7f8e\u5316<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u5f88\u591a\u4eba\u53ef\u80fd\u6ca1\u6709\u7528\u8fc7 nginx \u7684 autoindex \u529f\u80fd\u3002\u4f46\u662f\uff0c\u6211\u76f8\u4fe1\u5927\u5bb6\u90fd\u7528\u8fc7\u4e00\u4e9b\u7f51\u7ad9\u7684\u76ee\u5f55\u6d4f\u89c8\u529f\u80fd\u3002\u54ce [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[520,1152,313,1154,246],"class_list":["post-3803","post","type-post","status-publish","format-standard","hentry","category-yyzt","tag-ng-model","tag-nginx","tag-nginx-tfs","tag-246"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3803","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=3803"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3803\/revisions"}],"predecessor-version":[{"id":3804,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3803\/revisions\/3804"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}