PHP、nginx設定中跟上傳檔案大小有關的地方

如果你的 WordPress 上傳檔案處出現“最大上傳檔案大小:2 MB”,是被php限制上傳檔案大小。又或如果nginx server出現HTTP 413 (Request Entity Too Large)錯誤,或 error.log 中出現client intended to send too large body,就是被nginx server上傳檔案大小限制住了。

修改nginx:
/etc/nginx/sites-available/default
server {
...
client_max_body_size 10M;
...
}

重啟nginx
sudo service nginx restart

PHP 7.x:
/etc/php/7.x/fpm/php.ini
upload_max_filesize = 8M
post_max_size = 10M

重啟php-fpm
sudo service php7.x-fpm restart

(Visited 996 times, 1 visits today)

發佈留言