{"id":159883,"date":"2020-09-24T18:13:56","date_gmt":"2020-09-24T10:13:56","guid":{"rendered":"http:\/\/4563.org\/?p=159883"},"modified":"2020-09-24T18:13:56","modified_gmt":"2020-09-24T10:13:56","slug":"nginx-upload-module-%e6%80%a7%e8%83%bd%e5%b7%ae%ef%bc%8c%e6%98%af%e6%88%91%e7%9a%84%e9%97%ae%e9%a2%98%e8%bf%98%e6%98%af%e8%ae%be%e7%bd%ae%e7%9a%84%e9%97%ae%e9%a2%98%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=159883","title":{"rendered":"nginx upload module \u6027\u80fd\u5dee\uff0c\u662f\u6211\u7684\u95ee\u9898\u8fd8\u662f\u8bbe\u7f6e\u7684\u95ee\u9898\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  nginx upload module \u6027\u80fd\u5dee\uff0c\u662f\u6211\u7684\u95ee\u9898\u8fd8\u662f\u8bbe\u7f6e\u7684\u95ee\u9898\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Te11UA <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>Python \u4f7f\u7528\u8005\uff0c\u5bf9\u6bd4\u4e86\u4e00\u4e0b\u7528 Tornado Fastapi \u548c Nginx \u505a\u6587\u4ef6\u4e0a\u4f20\u670d\u52a1\u5668\uff0c\u5728 100+ \u5e76\u53d1\u7684\u60c5\u51b5\u4e0b\u6d4b\u8bd5\uff0c\u53d1\u73b0 Nginx \u8fd9\u4e2a\u6a21\u5757\u53ea\u7528\u4e86 120% \u5de6\u53f3\u7684 CPU\uff0c\u800c Python \u8fd9\u4e9b\u670d\u52a1\u53ef\u4ee5\u6253\u6ee1 CPU\uff0c\u4ece\u800c\u9020\u6210 Nginx \u4e0a\u4f20\u901f\u5ea6\u6bd4 Python \u6162 2-3 \u500d\u7684\u60c5\u51b5\u3002upload \u6a21\u5757\u7248\u672c\u4e3a 2.3.0\uff0cNginx \u4e3a 1.19.1\uff0cupload \u7684 conf \u5982\u4e0b\uff1a<\/p>\n<pre><code>server {     listen 80;      client_max_body_size 10M;   # \u6587\u4ef6\u4f20\u8f93\u9650\u5236 10M     upload_buffer_size 10M;     # \u6587\u4ef6 buffer 10M      location \/upload {         upload_pass @after_upload;          upload_store \/storage;         upload_store_access user:rw group:rw all:r;          upload_set_form_field $upload_field_name.name \"$upload_file_name\";         upload_set_form_field $upload_field_name.content_type \"$upload_content_type\";         upload_set_form_field $upload_field_name.path \"$upload_tmp_path\";          upload_aggregate_form_field $upload_field_name.md5 \"$upload_file_md5\";         upload_aggregate_form_field $upload_field_name.size \"$upload_file_size\";          upload_pass_form_field \"^.*$\";  #          upload_cleanup 400 404 499 500-505;     }      location @after_upload {         proxy_pass http:\/\/filesys_handler:8090;     } }  <\/code><\/pre>\n<p>\u6c42\u5927\u4f6c\u4eec\u80fd\u89e3\u60d1\uff0c\u5982\u679c\u8fd9\u4e2a\u6a21\u5757\u662f\u56e0\u4e3a\u7f3a\u4e4f\u652f\u6301\u800c\u8fd9\u6837\u7684\u8bdd\u6211\u5c31\u8981\u5f03\u7528\u4e86<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3445568\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nonduality <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528 nginx upload module \u4e0d\u6b63\u662f\u4e3a\u4e86\u51cf\u8f7b Python \u540e\u7aef\u7684 CPU \u5360\u7528\u4e48\uff1f\u800c\u4e14\u80fd\u51cf\u5c11 502 \u8d85\u65f6\u9519\u8bef\uff08\u5982\u679c\u90fd\u662f\u5c0f\u6587\u4ef6\u53e6\u8bf4\uff09\uff0c\u54ea\u80fd\u62ff CPU \u5360\u7528\u7387\u8bc4\u4f30\u4e0a\u4f20\u901f\u5ea6\u3002<\/p>\n<p>\u4ee5 Nginx \u7684\u6027\u80fd\uff0c\u600e\u4e48\u90fd\u8f6e\u4e0d\u5230\u662f Nginx \u662f\u901f\u5ea6\u74f6\u9888\uff0c\u770b\u770b Nginx \u5176\u4ed6\u90e8\u5206\u7684\u914d\u7f6e\u3002\u6709\u65f6\u4e3a\u4e86\u9632\u6b62\u4e0a\u4f20\u6d41\u91cf\u653b\u51fb\uff0c\u8fd8\u9700\u8981\u5728 ngxin upload module \u52a0\u9650\u901f\u6307\u4ee4\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3445569\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Te11UA <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @nonduality \u7684\u786e\u662f\uff0c\u4f46\u662f\u4e0a\u4f20\u901f\u7387\u6bd4 python \u6162\u5f88\u591a\uff0c\u6211\u7684\u573a\u666f\u4e3b\u8981\u662f 1M \u5de6\u53f3\uff0c100\/s \u5e76\u53d1\u7684\u5c0f\u6587\u4ef6\u4e0a\u4f20\uff0c\u8fbe\u4e0d\u5230\u8981\u6c42\u5440                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3445570\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nonduality <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c\u4f60\u76f4\u63a5\u7528 python \u540e\u7aef\u6765\u63a5\u6536\u4e0a\u4f20\u6587\u4ef6\uff0c\u4f60\u8981\u8003\u8651 CPU \u548c\u5185\u5b58\u5360\u7528\u8fc7\u9ad8\u7684\u95ee\u9898\uff0c\u800c\u7528 Nginx \u5219\u4e0d\u5b58\u5728\u8fd9\u4e2a\u95ee\u9898\uff0c\u4ece\u63d0\u9ad8\u8fd0\u884c\u6548\u7387\u7684\u89d2\u5ea6\uff0c\u65e0\u8bba\u5982\u4f55\u90fd\u5f97\u9009\u62e9 Nginx \u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u8bbe\u7f6e worker_processes \u4ece auto \u4e3a\u67d0\u4e2a\u66f4\u5927\u7684\u6570\u76ee\uff0c\u51cf\u5c11 nginx fork worker process \u5e26\u6765\u7684\u65f6\u95f4\u5f00\u9500\uff0c\u518d\u6d4b\u8bd5\u5e76\u53d1\u4e0a\u4f20\u901f\u5ea6\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>nginx upload modu&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/159883"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=159883"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/159883\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=159883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=159883"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=159883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}