Differences
This shows you the differences between two versions of the page.
gentoo_apache [2012/07/31 12:07] |
gentoo_apache [2012/07/31 12:07] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== 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. | ||
+ | |||
+ | <code> | ||
+ | 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" | ||
+ | </code> | ||
+ | |||
+ | ==== 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''. | ||
+ | |||
+ | <code>APACHE2_MPMS="worker"</code> | ||
+ | |||
+ | ==== 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: | ||
+ | |||
+ | <code>mkdir -p /etc/portage/env/www-servers</code> | ||
+ | |||
+ | Edit ''apache'' file in that directory and add this: | ||
+ | |||
+ | <code>CFLAGS="-O3 -pipe -march=native" | ||
+ | CXXFLAGS="${CFLAGS}"</code> | ||