Celebrate Our 22nd Anniversary with Huge Savings! Up to 70% Off

How to Set File Upload Size Limit in Apache?

As we know, Apache is an open-source and free web server. 

In this article, we will configure Apache to set a limit over file upload and download from your web server, as it is necessary to configure your webserver against the incoming client request. 

A web server affects the DDOS attack, so configuring it will also be helpful to prevent your web server from those attacks.

We can set the total size of HTTP requests using the LimitRequestBody directive. This can be defined in your website’s .htaccess or http.conf file.

We can set the required value between the range decided by the request body; it is from 0 (unlimited) to 2 GB.

Suppose you have a WordPress website and want to set a limit on the wp-upload folder to only allow uploads up to 200 KB, so you will need to add the below-given line inside your .htaccess or httpd.conf file – 

<Directory "/var/www/myapplication/wp-uploads">

 LimitRequestBody 200000 

<Directory>

Note
Once you make the above changes in your file, don't forget to save it.

After this, please restart and reload your HTTP service.

# service httpd restart
# service httpd reload


Was this answer helpful?

« Back

chat