Enable Upload Large File on PHP + Nginx
- Open file php.ini (should be located at /etc/php5/fpm/php.ini if you are using PHP-FPM. Otherwise, just find it using: sudo updatedb && locate php.ini)
- Edit these 3 variables:
- upload_max_filesize => 2M to (whatever you want. I tend use 128M)
- post_max_size => 2M to (same as above. just note if you expect to upload multiple files, set this variable higher than above)
- max_input_time => 60 to (your client's expected maximum upload time. should be max file size divided by minimum client's upload speed)
- Open your nginx configuration, add this parameters:
- client_max_body_size xxM; (same as post_max_size)
- fastcgi_read_timeout xxM; (same as max_input_time)
- Restart PHP-FPM and nginx: sudo service php5-fpm restart && sudo service nginx restart
- That's all folks!