Table of Contents

Apache Architecture

refer: http://stackoverflow.com/questions/17999140/prefork-vs-worker-module-for-apache-what-is-being-used
MPM(Multi Processing Module)

MPM Prefork Architecture

Basic configuration:

Config example:

<IfModule mpm_prefork_module>
    StartServers          6
    MinSpareServers       6
    MaxSpareServers      12
    MaxClients          12
    MaxRequestsPerChild   0
</IfModule>

check config:

MPM worker Architecture

Debug architecture of apache

Get current MPM is running: MPM Prefork or MPM worker

apachectl -V
Server version: Apache/2.2.15 (Unix)
Server built:   Apr  3 2014 23:56:16
Server's Module Magic Number: 20051115:25
Server loaded:  APR 1.3.9, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
...........................

compiled modules in MPM Prefork(httpd) and MPM worker(httpd.worker)

Debug processes and used memory, cpu

Optimize apache and PHP config

optimize load module apache

Config Optimize load modules for httpd with Explain directives with these modules:

LoadModule authz_host_module modules/mod_authz_host.so#Order
LoadModule access_compat_module modules/mod_access_compat.so#Require
LoadModule log_config_module modules/mod_log_config.so#LogFormat,TransferLog
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule env_module modules/mod_env.so
LoadModule setenvif_module modules/mod_setenvif.so#BrowserMatch
LoadModule mime_module modules/mod_mime.so#AddHandler
LoadModule autoindex_module modules/mod_autoindex.so#IndexOptions
LoadModule negotiation_module modules/mod_negotiation.so#LanguagePriority
LoadModule dir_module modules/mod_dir.so#DirectoryIndex
LoadModule alias_module modules/mod_alias.so#Alias
LoadModule rewrite_module modules/mod_rewrite.so

optimize load module php

Custom Config for Apache

Config disable warning log from browser

With this config, the log will display in PHP error log but they don't display in browser side\
Update httpd.conf

<IfModule mod_php5.c>
    php_admin_flag display_errors off
</IfModule>