I’m having trouble uploading files larger than 8 MB on my Laravel v11 application, which is hosted on Azure App Service running on Linux.
Here’s what I’ve already done to configure the upload limits:
-
Set the
client_max_body_size
directive in Nginx, and verified it’s working as expected:client_max_body_size 50M;
-
Updated PHP
php.ini
settings viaPHP_INI_SCAN_DIR
. Runningphp -i
on the server’s shell (SSH) confirms that the correct parameters are loaded:upload_max_filesize = 30M post_max_size = 50M memory_limit = 256M
Despite these settings, I can only upload files smaller than 8 MB. Trying to upload a file around 10 MB results in the following error:
The server returned a "413 Content Too Large".
Interestingly, when I set post_max_size
and upload_max_filesize
to 1M
, I’m still able to upload a 7 MB file successfully.
Here’s the output of php -i | grep max
on the server:
max_execution_time => 0 => 0
max_file_uploads => 20 => 20
max_input_nesting_level => 64 => 64
max_input_time => -1 => -1
max_input_vars => 1000 => 1000
max_multipart_body_parts => -1 => -1
post_max_size => 1M => 1M
upload_max_filesize => 1M => 1M
zend.exception_string_param_max_len => 15 => 15
session.gc_maxlifetime => 1440 => 1440
unserialize_max_depth => 4096 => 4096
What could be causing this issue? Any help would be greatly appreciated. Thanks in advance!