Apache 2.2

/etc/apache2/apache2.conf

<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 10000
</IfModule>

HostnameLookups Off

NameVirtualHost 80.247.227.130:80

AddDefaultCharset ISO-8859-1

PHP 5

/etc/php5/apache2/php.ini

output_buffering = 4096

zlib.output_compression = On
zlib.output_compression_level = 1

safe_mode = On

safe_mode_gid = Off

max_execution_time = 30
max_input_time = 60
memory_limit = 64M

display_errors = Off

log_errors = On

ignore_repeated_errors = On

register_globals = Off

upload_max_filesize = 8M

XCache

apt-get install php5-xcache

/etc/php5/apache2/conf.d/xcache.ini

xcache.size = 16M

xcache.count = 1

MySQL

/etc/mysql/my.cnf

skip-external-locking
skip-name-resolve

bind-address = 127.0.0.1
key_buffer = 64M
max_allowed_packet = 16M
thread_stack = 128K

query_cache_limit = 4M
query_cache_size = 50M

Monit

apt-get install monit

/etc/default/monit

startup=1

/etc/monit/monitrc

check process apache2 with pidfile /var/run/apache2.pid
group www-data
start program = "/etc/init.d/apache2 start"
stop program = "/etc/init.d/apache2 stop"
if failed host 127.0.0.1 port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout

Resources

http://www.ibm.com/developerworks/linux/library/l-tune-lamp-2.html
http://blog.nicolargo.com/2010/09/12-etapes-pour-optimiser-les-performances-de-son-blog-wordpress.html
http://phplens.com/phpeverywhere/tuning-apache-php
http://www.debianhelp.co.uk/mysqlperformance.htm
http://www.stochasticgeometry.ie/2010/03/10/performance-tuning-a-server-in-three-minutes-while-being-slashdotte/
http://www.cyberciti.biz/tips/howto-monitor-and-restart-linux-unix-service.html
http://mmonit.com/monit/documentation/monit.html#resource_testing