10

I've just installed Apache 2.4.7 (Ubuntu) on my Ubuntu 14.04 LTS system and can't see neither prefork nor worker settings in the /etc/apache2/apache2.conf. They are also not defined for default virtual host. Should I set them myself in apache2.conf like this?

<IfModule mpm_prefork_module>
    StartServers 2
    MinSpareServers 2
    MaxSpareServers 5
    MaxClients 200 #must be customized
    ServerLimit 200 #must be customized
    MaxRequestsPerChild 100
</IfModule>
10

Ubuntu 14 organizes all the module-specific configs in separate files under /etc/apache2/mods-available/, so the MPM prefork stuff is now located in /etc/apache2/mods-available/mpm_prefork.conf

| improve this answer | |
4

Have you looked for these settings within /etc/apache2/conf.d/? It's likely that these settings are kept in separate included files to aid with packaging.

Should I set them myself in apache2.conf like this?

<IfModule mpm_prefork_module>
    StartServers 2
    MinSpareServers 2
    MaxSpareServers 5
    MaxClients 200 #must be customized
    ServerLimit 200 #must be customized
    MaxRequestsPerChild 100
</IfModule>

Yes, you can place them in apache2.conf (though do look for them in other files in conf.d/ as mentioned above).

Your MaxRequestsPerChild seems very low - this can be in the thousands.

If you are running mod_php your MaxClients should be lowered significantly, unless you have many gigs of RAM.

| improve this answer | |
  • Thanks for your answer. My installation of Apache doesn't have conf.d at the /etc/apache2/. How is that possible? – Max Koretskyi Jun 25 '14 at 13:36
  • Sorry, that is what I get for writing this answer without testing on 14.04. I only have 12.04. Either they have changed the conf dirs for apache or something else is going on :) – thomasrutter Jun 25 '14 at 13:44
  • OK, we will wait for someone to clarify the matter :). Can you please elaborate on this Your MaxRequestsPerChild seems very low - this can be in the thousands. If you are running mod_php your MaxClients should be lowered significantly, unless you have many gigs of RAM. ? – Max Koretskyi Jun 25 '14 at 13:47
  • The default MaxRequestsPerChild is 10000 which means a process will only be restarted once every 10,000 requests per process. Dropping this to 100 seems like it would only harm performance unless you're experiencing a specific problem such as a bad memory leak. And for MaxClients, with mod_php you may need to lower this from its default because each process is so large - unless you have many Gigabytes of RAM. – thomasrutter Jun 26 '14 at 0:46

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.