1

Is there an apache setting where I can kill processes that run longer than 90 seconds? I got a DDOS attack and almost ran out of memory because a bunch of apache process were running for a long time.

2

Request timeouts

Take a look at the Apache module mod_reqtimeout, the config setting used with it is RequestReadTimeout.

Example: Allow for 5 seconds to complete the TLS handshake, 10 seconds to receive the request headers and 30 seconds for receiving the request body:

RequestReadTimeout handshake=5 header=10 body=30

To enable the module run these commands:

sudo a2enmod reqtimeout            # enable mod_reqtimeout
sudo service apache2 restart       # Re-start Apache

For more details consult Apache 2.4 mod_reqtimeout

Response Timeouts

On the response side, where a DDOS attack has induced lengthy PHP processing, look at max_execution_time PHP setting, which is normally set in php.ini.

The Apache TimeOut setting is for network I/O timeouts. It restricts the time Apache waits for a TCP packet from a client, and the time Apache waits for acknowledgement when a TCP packet is sent to a client.

  • I am on amazon Linux. I see LoadModule reqtimeout_module modules/mod_reqtimeout.so in /etc/httpd/conf.modules.d/00-base.conf. Does this mean it is loaded? – Chris Muench Aug 3 '19 at 5:17
  • To be certain - apachectl -M will list all loaded modules – suspectus Aug 3 '19 at 8:03
  • I have the module enabled. It says their is a default value. Is this used even though I never set directive? – Chris Muench Aug 3 '19 at 23:53
  • Yes, that is correct. You can of course override the settings in your config. Default for body is RequestReadTimeout body=10,minrate=500 – suspectus Aug 4 '19 at 12:16
  • What would you think is a reasonable value. I have a couple file processing uploads that could take 60-90 seconds but is rare – Chris Muench Aug 4 '19 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.