Can’t increase max POST size in Apache2

I’m trying to increase the POST requests size in order to let the users upload “big” files, after lots of “413 Request Entity Too Large” errors with small uploads (around 2 Mb).

My Apache2 is running on Ubuntu 16.04 with mod_security2 enabled, so I edited the configuration file located in /etc/modsecurity/modsecurity.conf, adding:

SecRequestBodyLimit 13107200
SecRequestBodyNoFilesLimit 13107200

Even if I restarted Apache2, this change seems to be ignored as I continue to see 413 errors with a test file of 2 Mbytes sent in POST.

So I opened the Apache2 config file /etc/apache2/sites-enabled/000-default.conf and edited it with:

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        LimitRequestFieldSize 10000000 # <-------
        LimitRequestBody 10000000      # <-------

</VirtualHost>

Again, no luck after a restart. Last change is to edit the php.ini, so I added this:

post_max_filesize="10M"
upload_max_filesize="10M"
post_max_size="10M"

Guess what? I’m still having 413 errors while I’m trying with 2Mbytes files.

I’m really can’t seeing another way to accomplish that, maybe is there some other config file to change?

Answer

You need to have the enctype=”multipart/form-data”

–> form action=”http://localhost:8000″ method=”post” enctype=”multipart/form-data” to do so…

Attribution
Source : Link , Question Author : TheUnexpected , Answer Author : Henry Ortiz

Leave a Comment