Home  »  ArticlesGuidesHow ToTechnology   »   How to Increase File Upload Size In Apache Web Server

How to Increase File Upload Size In Apache Web Server

Out of the box Apache has an upload limit of 2MB therefore there is a valid reason to increase file upload size to be able to handle larger files especially rich media such as video, audio, and image files.

Do This to Increase File Upload Size in Apache

You can use the Apache server directive LimitRequestBody to define the file’s size limit. This can be done in the apache configuration file or from within the .htaccess file.

Here we can assume the file is the default document root folder.

$ sudo vim /var/www/html/.htaccess

Enter the following in the .htaccess file. The example below limits the size to 64 MB (in bytes).

<Directory "/var/www/html/assets">
    LimitRequestBody 67108864
</Directory>

The above can also be added to the Apache server configuration file httpd.conf/apache.conf.

If you opt to add the directive in the Apache server configuration then you will need to restart the server for the settings to take effect.

$ sudo service apache2 restart

That’s it! You now know how to increase file upload size in Apache. You can also do the same configuration changes in PHP by following this guide.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Available under:
Articles, Guides, How To, Technology