Apache config for high traffic websites

Set up a Apache config that takes the max out of your server abilities.
The only goal is to serve as much visitors as possible.
Other things, like server load or bandwidth usage are not taken into account.

First step:
Check if there are any AH00161 errors

sudo cat /var/log/apache2/error.log | grep MaxRequestWorkers;
sudo cat /var/log/apache2/error.log | grep ServerLimit;

Check the average process size for Apache:

sudo ps -ylC apache2 | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Process Size (MB): "x/((y-1)*1024)}'

Determine a good setting by available memory:

Max instances = ((free mem + cached mem) - amount to keep spare) / Apache avg process size

Set MaxRequestWorkers and ServerLimit to this calculation in mpm_prefork.conf and restart Apache

Check again if there are any AH00161 errors

sudo cat /var/log/apache2/error.log | grep MaxRequestWorkers;
sudo cat /var/log/apache2/error.log | grep ServerLimit;

SSL apache config

A nice tool to configure & tweak your SSL setup in Apache.


Server wide SSL config can be found in %Apache-config-dir%/mods-enabled/ssl.conf

Test your SSL configuration:


Check the Apache error log to make sure there are not to many handshake errors.
Many AH02042 errors can be a good reason to lower the cipher strenght

cat /var/log/apache2/error.log | grep ssl
cat /var/log/apache2/error.log | grep SSL

Drupal large file uploads up to 8GB

This code should work with files up to 8GB.
Apache in combination with Suhosin security patch & pecl upload progress bars (AJAX).
Put this into the php.ini file or where ever you store your PHP config.

max_execution_time = 3200 ; Maximum execution time of each script, in seconds
max_input_time = 3200 ; Maximum amount of time each script may spend parsing request data
memory_limit = 8G; Maximum amount of memory a script may consume
upload_max_filesize = 8G ; Maximum allowed size for uploaded files.
post_max_size = 8G ; Maximum size of POST data that PHP will accept.
max_input_vars = 100000
suhosin.request.max_vars = 100000
suhosin.post.max_vars = 100000
max_input_nesting_level = 100000