Centos5 Recompile Apache to Change Suexec Docroot to Home
07 May, 2011
In order to change PHP execution mode to CGI wrapper for better control for shared hosting, we need to recompile apache to change the Suexec default directory. Below are the steps:
wget http://mirror.centos.org/centos/5/updates/SRPMS/httpd-2.2.3-53.el5.centos.1.src.rpm
useradd mockbuild
rpm -Uvh httpd-2.2.3-53.el5.centos.1.src.rpm
nano /usr/src/redhat/SPECS/httpd.spec
change %define contentdir /var/www to %define contentdir /home
You may need to install some missing packages, in my case:
yum install xmlto pcre-devel distcache-devel
rpmbuild -bb /usr/src/redhat/SPECS/httpd.spec
rpm -iUvh --replacepkgs --nodeps --force /usr/src/redhat/RPMS/x86_64/httpd-2.2.3-53.1.x86_64.rpm /usr/src/redhat/RPMS/x86_64/httpd-devel-2.2.3-53.1.x86_64.rpm /usr/src/redhat/RPMS/x86_64/httpd-manual-2.2.3-53.1.x86_64.rpm /usr/src/redhat/RPMS/x86_64/mod_ssl-2.2.3-53.1.x86_64.rpm