====== Gentoo Linux: Apache ======
* [[Apache]]
* [[Apache Worker MPM PHP CGI Suexec Setup]]
* [[Gentoo]]
Running Apache on Gentoo gives you a lot of flexibility. However, out of the box, there are a lot of modules that are not used in many client configurations.
==== Modules ====
The modules that Apache is built with can be set by ''APACHE2_MODULES'' in ''/etc/make.conf''.
Here is a trimmed down version that removes many unused modules.
APACHE2_MODULES="actions alias auth_basic authn_default auth_digest authn_file authz_default
authz_host authz_user autoindex cache cgi cgid deflate dir disk_cache env expires file_cache
filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite
setenvif status unique_id userdir vhost_alias"
==== MPMS ====
Gentoo lets you configure the MPM in use. The most common ones are ''prefork'' and ''worker'', with ''prefork'' being the default. You can change this in ''make.conf''.
APACHE2_MPMS="worker"
==== Optimization ====
You can build Apache, or any program, with different settings than used by ''make.conf''. Apache is a good candidate, since it is a primary application in the LAMP stack.
An optimized version using gcc with highest optimizations:
mkdir -p /etc/portage/env/www-servers
Edit ''apache'' file in that directory and add this:
CFLAGS="-O3 -pipe -march=native"
CXXFLAGS="${CFLAGS}"