因WordPress 外掛Elementor 存檔跳 500 Internal Server Error,檢查了Nginx的Error Log,連帶發現
[warn] a client request body is buffered to a temporary file /var/lib/nginx/tmp/client_body/000000000x
參考:Nginx buffered to a temporary file 问题解决
修改nginx設定後即解決,如下。
##原有設定##
location ~* \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
##加入下方設定##
fastcgi_max_temp_file_size 0;
fastcgi_buffer_size 4K;
fastcgi_buffers 32 8k;
client_max_body_size 500m; ##這筆是用來調整上傳限制
client_body_buffer_size 1024k;
此問題與memory_limit可能要一起調整,才能完整解決 500 Internal Server Error。
因一開始只針對Allowed memory size of 268435456 bytes exhausted (tried to allocate 331776 bytes) 來處理時,
提高限制為300MB一樣會跳錯,最後兩個都改完就沒跳錯了。