Cut it short, what I need is to configure my nginx-php to be able to handle around 200M file upload.
So here are the configuration changes I need to make:
1. nginx.conf
usually the file is placed in /etc/nginx/nginx.conf.
The parameters to add inside http are:
- client_max_body_size: specifies the maximum accepted body size of a client request
- client_body_timeout: sets the read timeout for the request body from client
http {
##
# Basic Settings
##
client_max_body_size 200m;
client_body_timeout 600s;
....
}
2. php.ini
Since I use php5-fpm, this file is placed in /etc/php5/fpm/php.ini
The parameters to change is:
- post_max_size: Sets max size of post data allowed
- upload_max_filesize: The maximum size of an uploaded file
- max_execution_time:This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.
- max_input_time: This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET.
After changing those variables, restart both nginx and php5-fpm and you're done!
Reference links:
http://wiki.processmaker.com/index.php/Nginx_and_PHP-FPM_Installation
https://rtcamp.com/tutorials/php/increase-file-upload-size-limit/
http://www.radinks.com/upload/config.php
http://wiki.nginx.org/HttpCoreModule#client_body_timeout
So here are the configuration changes I need to make:
1. nginx.conf
usually the file is placed in /etc/nginx/nginx.conf.
The parameters to add inside http are:
- client_max_body_size: specifies the maximum accepted body size of a client request
- client_body_timeout: sets the read timeout for the request body from client
http {
##
# Basic Settings
##
client_max_body_size 200m;
client_body_timeout 600s;
....
}
2. php.ini
Since I use php5-fpm, this file is placed in /etc/php5/fpm/php.ini
The parameters to change is:
- post_max_size: Sets max size of post data allowed
- upload_max_filesize: The maximum size of an uploaded file
- max_execution_time:This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.
- max_input_time: This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET.
After changing those variables, restart both nginx and php5-fpm and you're done!
Reference links:
http://wiki.processmaker.com/index.php/Nginx_and_PHP-FPM_Installation
https://rtcamp.com/tutorials/php/increase-file-upload-size-limit/
http://www.radinks.com/upload/config.php
http://wiki.nginx.org/HttpCoreModule#client_body_timeout