Apache2/MySQL on Ubuntu Configuration

Once you’ve installed apache2 and mysql on your server, you might want to try these configuration changes to make it perform a bit better:

In /etc/mysql/my.cnf

key_buffer = 16K
max_allowed_packet = 1M
thread_stack = 64K
table_cache = 4
sort_buffer = 64K
net_buffer_length = 2K

And in Apache2′s config, /etc/apache2/apache2.conf, find the section for MPM prefork if yo have it and:

StartServers 1
MinSpareServers 3
MaxSpareServers 6
ServerLimit 24
MaxClients 24
MaxRequestsPerChild 3000

The above are just some things to try if you encounter a situation where apache is using too much memory, or the same for mysqld.

About Jason

I am a 31 year old programmer living in the south of France. I currently work actively in the fields of Ruby/PHP/Javascript and server/website administration.