limit UPLOAD files to 1KB from APACHE, NOT from scripts

000

Well-Known Member
Jun 3, 2008
533
29
78
hello,

why when we config the file /etc/apache2/conf/httpd.conf in cPanel with the options
Code:
<Directory "/home">
    LimitRequestBody 1024 # file MAX 1KB
<Directory>
or directlly with the string:
Code:
    LimitRequestBody 1024 # file MAX 1KB
users can UPLOAD files with more of 1KB ?

we wait the result from OTHERS servers with Apache:


1645481972544.png
we need config this directlly from Apache,
not from SCRIPT.

thanks
 

000

Well-Known Member
Jun 3, 2008
533
29
78
of course:

we not only restart Apache,
we restart the complet server !!
 

000

Well-Known Member
Jun 3, 2008
533
29
78
finally we do this ( 1 = 1MB ):

1645486349512.png

and neither work, we can upload files of 3MB, 5MB, etc....

but we need 1KB
 

000

Well-Known Member
Jun 3, 2008
533
29
78
Hey there! Can you let me know specifically where you were editing that configuration option, and how you were testing the upload after that change?
thanks,

as we say in our first message:

we config the file /etc/apache2/conf/httpd.conf in cPanel with the options

Code:
<Directory "/home">
LimitRequestBody 1024 # file MAX 1KB
<Directory>
or directlly with the string:
Code:
   LimitRequestBody 1024 # file MAX 1KB
we put this two options directly on the file /etc/apache2/conf/httpd.conf

note:
we put ONE or OTHER and restart Apache, however nothing change:

users can UPLOAD files of 1MB, 10MB, 100MB, etc...
 

000

Well-Known Member
Jun 3, 2008
533
29
78
Thanks, I just wanted to confirm.

Do you have an example of the code you're using so I could try to replicate this on my end?
of course,
here is the code:

you can choice, option #1:
Code:
<Directory "/home">
    LimitRequestBody 1024 # file MAX 1KB
<Directory>
or option #2:

Code:
 LimitRequestBody 1024 # file MAX 1KB
paste this DIRECTLY on the file

/etc/apache2/conf/httpd.conf

that is the info FROM
 

000

Well-Known Member
Jun 3, 2008
533
29
78
I'm sorry - I meant the code of the HTML form, not the Apache configuration option.
Code:
<form
 action="https://website.com/process/" method="post"
 enctype="multipart/form-data"
>
<input type="file" name="data" value="file" />
<input type="submit" />
</form>
logically use upload_max_filesize is 100% obtuse, (any user/form can change, remove this field)
 

Spirogg

Well-Known Member
Feb 21, 2018
700
161
43
chicago
cPanel Access Level
Root Administrator
Code:
<form
action="https://website.com/process/" method="post"
enctype="multipart/form-data"
>
<input type="file" name="data" value="file" />
<input type="submit" />
</form>
logically use upload_max_filesize is 100% obtuse, (any user/form can change, remove this field)
have you tried in WHM Home >software >Multiphpini Editor
change the upload file size in php editor ?

then users can't change file upload limit..

even if they change in Cpanel for 100mb will not work, because it will have default you set im whm

just an idea if you have not tried it?
 

000

Well-Known Member
Jun 3, 2008
533
29
78
have you tried in WHM Home >software >Multiphpini Editor
change the upload file size in php editor ?

then users can't change file upload limit..

even if they change in Cpanel for 100mb will not work, because it will have default you set im whm

just an idea if you have not tried it?
thanks :) , as we say in the title:

we need resolve from APACHE:
for any language: PERL, PHP, PYTHON, etc...

ALL managed from APACHE
 

Spirogg

Well-Known Member
Feb 21, 2018
700
161
43
chicago
cPanel Access Level
Root Administrator
thanks :) , as we say in the title:

we need resolve from APACHE:
for any language: PERL, PHP, PYTHON, etc...

ALL managed from APACHE
Code:
How to set File Upload Size limit in Apache?  Print
0
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
 

000

Well-Known Member
Jun 3, 2008
533
29
78
Code:
How to set File Upload Size limit in Apache?  Print
0
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
yes!,

please see our reply #3, we quote:


1645592674937.png


but in cPanel this fail

then how we config to 1KB, or how we use LimitRequestBody to 1KB into a server cPanel ?
 

Spirogg

Well-Known Member
Feb 21, 2018
700
161
43
chicago
cPanel Access Level
Root Administrator
<Directory "/home"> LimitRequestBody 1024 # file MAX 1KB <Directory>
is Directory /home the full path?
 

Spirogg

Well-Known Member
Feb 21, 2018
700
161
43
chicago
cPanel Access Level
Root Administrator
sure, is for ALL users!
have you tried to add another /

so <Directory "/home/"> LimitRequestBody 1024 # file MAX 1KB <Directory>