RequestReadTimeout for virtual host - Apache

CentOS Aug 23, 2017

If your file upload fail, you probably have to adjust the RequestReadTimeout configuration parameter of your apache web server.

Today, I switched the "server scripts/data" (another side project) from  my local apache server (XAMPP) to my VPS. It's an Android app with mostly server side data. It is also possible to upload images to the  server. The PHP-Script handles the upload process. One problem was the  error: UPLOAD_ERR_PARTIAL

How to solve it?

This error is in the documentation described as "Value: 3; The uploaded file was only partially uploaded.". But I couldn't find the reason with this description. Let's have a look in the error_log of the apache httpd.

[...] AH01382: Request body read timeout

After another research I found out, that the RequestReadTimeout was too low for my upload. To modify the timeouts, we have to edit the mod_reqtimeout module.

First, check if the module is installed and activated:

apachectl -M

This list should contain something like "reqtimeout_module (shared)".

As explained here,  I have multiple virtual hosts configured. Because of that, I don't want  to set the new values for all hosts, so I couldn't edit  /etc/httpd/conf/httpd.conf. Since I have created single configuration  files, I had the advantage that the changes will only take effect on  this host.

nano /etc/httpd/sites-available/[XYZ].conf

Replace [XYZ] with your configuration file.

We can now easily set the RequestReadTimeout to unlimited (or another value) for the header and the body by adding:

RequestReadTimeout header=0 
RequestReadTimeout body=0 

Just restart the httpd daemon and you are ready to go

apachectl restart

This solved my problem.

It is  probably not a good idea to set no limits for these timeouts. I'm now  trying to find the best value. What is your best practice?

Please comment below, if you have any questions.

Tested on:

  • OS: CentOS 7
  • Apache: 2.4.6
  • PHP: 7.1.7




Howdy! I'm Stefan and I am the main author of this blog. If you want know more, you can check out the 'About me' page.

Impressum | Data Privacy Policy | Disclaimer
Copyright: The content is copyrighted and may not be reproduced on other websites without permission.