How to Increase upload file size max, Laravel, PHP, Nginx Docker
So today my client ask me how to increase max upload file size for the website, because default upload for each file is 1MB, so i will increase at least, it can upload more than 5MB, upload just for document, my spesification is phpfpm7.2, Nginx 1.62 and etc, cause i will just discuss about these two,
I found the solution from this https://easyengine.io/tutorials/php/increase-file-upload-size-limit so i’ll detail it, as far as i could, first we will change default limit for upload in php fpm ini folder /usr/local/etc/php/conf.d.
in running docker container you must get in, in the container which is my container:dkr4_php_1 bash, so i enter the container docker exec -ti dkr4_php_1 bash and get to the folder /usr/local/etc/php/conf.d then create new file uploads.ini this name is free whatever you want but the extension must .ini if you want the easiest way type this vim /usr/local/etc/php/conf.d/uploads.ini , im using vim editor, then code this in uploads.ini
file_uploads = On
memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 600
save it, in vim editor :wq, save and exit
okay next we will change configuration in nginx, first we must enter to nginx container my container is dkr4_nginx_1, so we will enter docker exec -ti dkr4_nginx_1 bash, after we get in we get to the folder /etc/nginx/nginx.conf
or the easiest way vim /etc/nginx/nginx.conf
add
http {
…
client_max_body_size 100M; //add this in your code http nginx.conf
}
then exit container
lastly stop and start again the php container and nginx container
taddaaa it works