Skip to main content

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

Comments

41 comments

  • 000
    of course: we not only restart Apache, we restart the complet server !!
    0
  • 000
    Apache say:
    0
  • 000
    finally we do this ( 1 = 1MB ): and neither work, we can upload files of 3MB, 5MB, etc.... but we need 1KB
    0
  • cPRex Jurassic Moderator
    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?
    0
  • 000
    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: [QUOTE] we config the file /etc/apache2/conf/httpd.conf in cPanel with the options LimitRequestBody 1024 # file MAX 1KB
    or directlly with the string: 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...
    0
  • cPRex Jurassic Moderator
    Alright, and how are you testing the upload limit after Apache is restarted?
    0
  • 000
    Alright, and how are you testing the upload limit after Apache is restarted?

    thanks by your time master @cPRex we upload from FORM http and https
    0
  • cPRex Jurassic Moderator
    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?
    0
  • 000
    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: LimitRequestBody 1024 # file MAX 1KB
    or option #2: LimitRequestBody 1024 # file MAX 1KB
    paste this DIRECTLY on the file /etc/apache2/conf/httpd.conf that is the info FROM
    0
  • cPRex Jurassic Moderator
    I'm sorry - I meant the code of the HTML form, not the Apache configuration option.
    0
  • 000
    I'm sorry - I meant the code of the HTML form, not the Apache configuration option.


    logically use upload_max_filesize is 100% obtuse, (any user/form can change, remove this field)
    0
  • Spirogg

    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?
    0
  • 000
    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
    0
  • Spirogg
    thanks :), as we say in the title: we need resolve from APACHE: for any language: PERL, PHP, PYTHON, etc... ALL managed from APACHE

    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. LimitRequestBody 200000 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
  • 000
    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. LimitRequestBody 200000 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: but in cPanel this fail then how we config to 1KB, or how we use LimitRequestBody to 1KB into a server cPanel ?
    0
  • Spirogg
    LimitRequestBody 1024 # file MAX 1KB

    is Directory /home the full path?
    0
  • 000
    is Directory /home the full path?

    sure, is for ALL users!
    0
  • Spirogg
    sure, is for ALL users!

    have you tried to add another / so LimitRequestBody 1024 # file MAX 1KB
    0
  • Spirogg
    not sure but maybe you can add your limit here not sure if you looked here and if it might work here?
    0
  • Spirogg
    not sure but maybe you can add your limit here 75953 not sure if you looked here and if it might work here?

    ( EDIT ) LimitRequestBody 1024 this worked
    0
  • Spirogg
    ok I tried it this way LimitRequestBody 1024 and it accepted.. maybe you can try it again in global config. and just add LimitRequestBody 1024
    see if that works for you
    0
  • Spirogg
    hello @000 I added this line LimitRequestBody 1024
    in all 3 of the options in my screen shot and then went to my website and tried to upload a small photo and it would not allow me too. so its working here. you can try it and hope it works for you as well..
    0
  • Spirogg
    @000 this worked for me. I could not upload any photo even a small photo to my website via a upload form.. so its working for me.... hope this helps you :)
    0
  • Spirogg
    so this worked for me. in php max file size I have set my uploads to100mb in both my scripts.. 2 different cPanel accounts and after entering this line of code LimitRequestBody 1024
    here below in WHM
    • Home "Service Configuration "Apache Configuration "Include Editor
    I can't upload any files now.. when I remove the line of code then I can upload again..
    0
  • 000
    thanks. change LimitRequestBody 512 # file MAX 1KB
    by LimitRequestBody 512 # file MAX 1KB
    result in NOTHING change. again: why the directive limitrequestbody from Apache
    0
  • 000
    not sure but maybe you can add your limit here -02-22 at 11.22.49 PM.png">75953 not sure if you looked here and if it might work here?

    result of this is 0:
    0
  • 000
    thanks by your time @Spirogg, when we save this change: and we restart Apache the result is: NOTHING CHANGE
    0
  • cPRex Jurassic Moderator
    I was going to mention that editing the Apache configuration directly is fine for brief testing, but it should be performed through includes to ensure it doesn't get overwritten in the future. I'm not sure why that value isn't working for you on that particular machine. Could you open a ticket with our support team so we can check this out?
    0
  • 000
    hello master cPrex,
    ... that value isn't working for you on that particular machine...

    in your machine YES work ?
    0
  • cPRex Jurassic Moderator
    Yes, I see this working how I would expect on my end.
    0

Please sign in to leave a comment.