Apache, higher performance - MPM worker and Fcgid

After reading on many places that drupal should work better with MPM-worker and fcgid I decided to swith my debain to that configuration. For that I had to do the usuall, collect the info around the web and hope for the best. So here goes information about this on Debian Linux.

First we need to install worker and FastCGI

apt-get install apache2-mpm-worker  libapache2-mod-fcgid

then enable

a2enmod fcgid

then some more install

aptitude install php5-cgi php5-cli

then put this into your /etc/apache2/httpd.conf file and change
/var/www to your directroy where your web sites are so php can be run, sites that are not there will not work.

<Directory /var/www>
AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php
Options +ExecCGI
</Directory>
# If you have Aliases provide php support for them (Here we provide php support for scripts in /usr/share's subdirectories)
Alias /aptitude /usr/share/doc/aptitude/html/en
Alias /apt /usr/share/doc/apt-doc

<Directory /usr/share>
AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php
Options ExecCGI FollowSymlinks Indexes
</Directory>

then restart your apache

/etc/init.d/apache2 restart

If you have a site outside directory mentioned above, add this to your virtual host file and you will have PHP there aswell.

<VirtualHost *:80>
     ServerAdmin marko@drupaldump.com
     ServerName drupaldump.com
     ServerAlias www.drupaldump.com
     DocumentRoot /home/dd/public_html/
     ErrorLog /home/dd/logs/error.log
     CustomLog /home/dd/logs/access.log combined
<Directory  /home/dd/public_html/>
AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php
Options +ExecCGI
</Directory>
</VirtualHost>

So that should do it for a start. You can then configure more your apache2.conf for MPM-worker and read more about this here http://groups.drupal.org/node/27174 and for other linux systems and more details read here

http://ubuntuforums.org/showthread.php?t=1038416
http://www.failover.co/blog/quick-setup-apache-worker-fastcgi-php-fpm-a…
http://www.lifelinux.com/installing-apache-with-worker-mpm-and-php-fast…
http://ubuntuforums.org/showthread.php?t=1038416
http://2bits.com/articles/apache-fcgid-acceptable-performance-and-bette…