By default, Apache has a default upload size of 2Mb. However, sometimes this can be limiting, in case your users want to upload bigger files, images & videos to your website. In that case, they will end up seeing an error message unless you increase the max file upload size in Apache. Here’s how you can increase max file upload size in Apache.
How to Increase Max File Upload Size in Apache
To increase max file upload size in Apache, we use the LimitRequestBody directive. It makes Apache check the HTTP request body size. You can set its value from 0 to 2GB.
You can set this directive for in context of your server, directory, location or even file.
For example, if you want to increase max file upload size in wordpress, add the following lines to your .htaccess file. Please make sure you have enabled .htaccess for your Apache server. If not, then here’s how to do it.
<Directory "/var/www/example.com/wp-uploads"> LimitRequestBody 5242880 </Directory>
Save and quit the file. Restart your Apache server to apply changes.
$ systemctl restart httpd #systemd OR $ service httpd restart #sysvinit
Now your users can upload bigger files, without getting an error message.