Config Nginx / PHP (PHP-FPM) untul handle upload file
October 30, 2019 06:43AM
Selamat sore. Salam kenal.

Saya sedang ada case berikut.

Saya ada website company profile, dibikin pake php (php-fpm), webserver nya pake nginx.

Nah, kendalanya adalah, tidak bisa upload file berukuran besar (dicoba 30MB gagal terus).

Berikut versi php dan nginx :

[root@xxxxxx]# php-fpm --version
PHP 7.0.33 (fpm-fcgi) (built: Aug 28 2019 14:13:14)
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

[root@xxxxxx]# php --version
PHP 7.0.33 (cli) (built: Aug 28 2019 14:11:09) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

[root@xxxxxx]# nginx -v
nginx version: nginx/1.16.1

Berikut setting di /etc/php.ini yg. terkait dengan file upload :
- post_max_size = 100M
- upload_max_filesize = 100M
- max_execution_time = 3600
- max_input_time = 3600

Berikut setting di /etc/nginx/conf.d/nginx.conf :

server {
listen 443 ssl;
... ... ...
client_max_body_size 100M;
client_body_timeout 60s;
... ... ...
... ... ...
location {
client_max_body_size 100M;
client_body_timeout 60s;
}
}

server {
listen 80;
return 301 ... ... ...
client_max_body_size 100M;
client_body_timeout 60s;
}

Jadi pas upload, errornya di UI website bilang "File too big",
dan di log access nginx nya sempet bilang dia kena http status 413 (Request Entity Too Large).

Mungkin Rekans ada yg pernah mengalami hal serupa, mungkin ada insight (mohon maaf kalau case ini salah alamat, mestinya ke PHP bukan ke NGINX).

Terima kasih sebelumnya,
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 259
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready