How to set File Upload Size limit in Apache?

As we know Apache is an open-source and free web server. Here, we will configure apache to set limit over file upload and download from your web server. It is always necessary to configure your webserver against the incoming client request. Nowadays, webserver does affect the DDOS attack. This should also be useful to prevent your webserver from those attacks as well.

We can set a total size of HTTP requests using the LimitRequestBody directive. This can be defined in your websites .htaccess or in http.conf file. We can set the required value in between the range of decided by the request body. It is from 0 (unlimited) to 2 GB.

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

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

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
  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to create users and groups in CentOS7?

Once the Linux system is configured, adding and removing users is one of the most basic tasks...

How to run ClamAV scan from SSH in cPanel server?

In this article, we'll discuss how to run ClamAV scan via SSH in cPanel/WHM server. ClamAV is one...

How Do I Check Bandwidth Utilization of VPS?

Windows VPS To check/monitor usage of each Windows VPS, we have installed bandwidth meter tool...

How to upgrade Debian 7 (Wheezy) to 10 (Buster) version?

It is always recommended to upgrade the version to prevent any security vulnerability. You can...

How to install Dotnet Core on Centos 7 ?

Dotnet Core is now available with the Linux OS. Following are the steps to install Dotnet Core on...