{"id":456,"date":"2023-02-25T13:23:44","date_gmt":"2023-02-25T05:23:44","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=456"},"modified":"2023-04-29T20:59:49","modified_gmt":"2023-04-29T12:59:49","slug":"modify-upload-size-limit-for-php-and-nginx-files","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/modify-upload-size-limit-for-php-and-nginx-files\/","title":{"rendered":"\u4fee\u6539PHP\u548cNginx\u6587\u4ef6\u4e0a\u4f20\u5927\u5c0f\u9650\u5236"},"content":{"rendered":"<h3>php.ini<\/h3>\n<pre><code>\/\/post_max_size \u7684\u503c\u52a1\u5fc5\u8981\u5927\u4e8e upload_max_filesize \u7684\u503c\npost_max_size = 8M\nupload_max_filesize = 5M<\/code><\/pre>\n<p><!-- more --><\/p>\n<h3>vhost.conf<\/h3>\n<pre><code>server {\n    listen       80;\n    server_name  api.yezhou.me;\n    index index.html index.htm index.php;\n    root \/data\/www\/HttpApi\/public;\n    server_name_in_redirect off;\n\n    location \/ {\n        try_files $uri $uri\/ \/index.php?$query_string;\n    }\n\n    location ~ .+\\.php($|\/)\n    {\n        #fastcgi_pass  unix:\/tmp\/php-cgi.sock;\n        fastcgi_pass  127.0.0.1:9000;\n        fastcgi_index index.php;\n        include       fastcgi.conf;\n\n        fastcgi_split_path_info  ^(.+\\.php)(\/.*)$;\n        fastcgi_param  PATH_INFO $fastcgi_path_info;\n\n        client_max_body_size  5m;  #\u5ba2\u6237\u7aef\u4e0a\u4f20\u6587\u4ef6\u5927\u5c0f\u9650\u5236\u8bbe\u4e3a5M\n    }\n    location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf)$\n    {\n        expires 30d;\n    }\n    location ~ .*\\.(js|css)?$\n    {\n        expires 1h;\n    }\n    #\u4f2a\u9759\u6001\u53ca\u65e5\u5fd7\n    #include \/data\/server\/nginx\/conf\/rewrite\/default.conf;\n    access_log \/data\/server\/nginx\/logs\/api-access.log;\n}<\/code><\/pre>\n<pre><code>nginx -s reload<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>php.ini \/\/post_max_size \u7684\u503c\u52a1\u5fc5\u8981\u5927\u4e8e upload_max_filesize \u7684\u503c  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[25,47],"class_list":["post-456","post","type-post","status-publish","format-standard","hentry","category-devops-base","tag-nginx","tag-php"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/456","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=456"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/456\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}