suPHP on CentOS 6
I have different users that have websites reached through different domains. I have been using mpm-itk for making apache run with different user permissions. So that every user can store her own public_html in her own home directory and manage using her own ssh/ftp account. After switching to CentOS 6 from Arch Linux on the server-side, I decided to give suPHP a try instead of mpm-itk because mpm-itk is told to have security holes.
I was worried about suPHP's configuration to be difficult but it is surprisingly easy and very similar to mpm-itk.
First you need to add rpmforge repository (reporforge is the new name) because suPHP isn't available in CentOS' official repositories (to be able to use commands i gave you should be using CentOS 6 with i686 structure).
$ rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpmyum install mod_suphp
Then you should do some configuration, edit /etc/suphp.conf
Edit the line,
x-httpd-php=php:/usr/bin/php
to
x-httpd-php="php:/usr/bin/php-cgi"
and the line
x-suphp-cgi=execute:!self
to
x-suphp-cgi="execute:!self"
and you are done (you need to have php-cli
package installed) :) Now you can use a apache configuration like following for the virtualhost to be runned with suPHP,
<VirtualHost *:80>
ServerAdmin root@domain.tld
ServerName domain.tld
ServerAlias www.domain.tld
suPHP_Engine on
suPHP_UserGroup user group
AddHandler x-httpd-php .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-php
DocumentRoot /home/user/public_html/
</VirtualHost>
If you happen to get Forbidden
error trying to reach the virtualhost using suPHP, give +x permission to user's home directory.
chmod 701 /home/user