microsoft Azure

INCREASE MAX UPLOAD FILE SIZE AZURE NGINX

Hasitha Charaka 🔵
3 min readJan 26, 2023

--

Issue Analysis:
I have made some tests on my end, and you could refer to my steps on
increasing the upload file size of my App Service:

Go to the SSH console of the App Service

Go to site/wwwroot folder.(Laravel user go to public folder)We will use the command

echo “<?php phpinfo();”>>info.php

to create a PHP info page. You could skip this
step if you already have one.

Navigate to https://<sitename>.azurewebsites.net/info.php, and we
could see the max upload file size is 2M

Now we could go back to SSH console and go back to home/site
directory. Use command mkdir ini to create a folder. Go to the folder
and use command echo “upload_max_filesize=50M” >> extensions.ini This
will create a file and write to it. Use command cat extensions.ini and
confirmed the write operation is successful. In this way, we created a
setting and configured the max_file_upload_size to 50M

  • Note if you want to increse post_max_size also add same extensions.ini*
post_max_size

We’ll now need to go to the Azure Portal and add an Application
Setting to scan the “ini” directory that we just created to apply
the change for upload_max_filesize. In order to do that, you could
navigate to the _configuration_ blade of your App Service and add a new
application setting. For the App Setting Name, enter
“PHP_INI_SCAN_DIR”. For the value, enter
“/usr/local/etc/php/conf.d:/home/site/ini”. Please note that
saving application setting change will restart your App Service

azure configuration

Navigate to https://<sitename>.azurewebsites.net/info.php, and we
could see the max upload file size has increase to 50M

phpinfo.php

Remove the info.php page once you’re done using the page.

remove command : rm -r filename

If you enjoy my content and would like to support me, you can do so through Buy Me a Coffee. Your support means the world to me and will help me to continue creating and improving the quality of my work. By buying me a coffee, you’ll be providing me with the motivation and resources to keep pursuing my passion and bringing you the content that you love. Your generosity will help cover the costs of hosting, equipment, and other expenses associated with my work. Thank you so much for considering supporting me through Buy Me a Coffee, and for being a part of my community!

happy coding

--

--