Apache is a solid web server but my goto environment for wordpress has now changed to running it on Docker with NGINX + php7.4-fpm-alpine. To change the max file size you can upload to wordpress, you will need to make changes to two places:
NGINX
In the server block set the client_max_body_size like so
server {
listen 443 ssl;
server_name '"$COMMON_NAME"';
ssl_certificate /home/server.crt;
ssl_certificate_key /home/server.key;
root /var/www/html;
client_max_body_size 100M;
This setting controls how much the web server itself will allow before wordpress even comes into the picture.
php7.4-fpm-alpine
Create following file if it does not exist /usr/local/etc/php/conf.d/uploads.ini and edit it like so:
file_uploads = On
memory_limit = 500M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 600
max_file_uploads = 50000
max_execution_time = 5000
max_input_time = 5000
You are all set! Above settings control how much wordpress will allow. Take a look at wp_max_upload_size
Tip: Verify /usr/local/etc/php/conf.d/uploads.ini is indeed the correct file to modify by running phpinfo() in PHP REPL
bash-5.0# php -a
Interactive shell
php > phpinfo();
phpinfo()
PHP Version => 7.4.5
...
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => (none)
Scan this dir for additional .ini files => /usr/local/etc/php/conf.d
Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini,
/usr/local/etc/php/conf.d/docker-php-ext-exif.ini,
/usr/local/etc/php/conf.d/docker-php-ext-gd.ini,
/usr/local/etc/php/conf.d/docker-php-ext-imagick.ini,
/usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini,
/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini,
/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini,
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini,
/usr/local/etc/php/conf.d/error-logging.ini,
/usr/local/etc/php/conf.d/opcache-recommended.ini,
/usr/local/etc/php/conf.d/uploads.ini
2021/02/10: As I learnt yesterday for a multisite installation there is one more thing to do which is to update the fileupload_maxk setting in MySQL. It can be done using following wp cli command:
bash-5.0# wp site option update fileupload_maxk 10000 --allow-root
Success: Updated 'fileupload_maxk' site option.
More details about this setting can be found here.