recompile apache from src.rpm to change suexec docroot to /home
You may need to do this as a solution to a virtualmin error on standard redhat systems install:
"The Suexec command on your system is configured to only run scripts under /var/www, but the Virtualmin base directory is /home. CGI and PHP scripts run as domain owners will not be executed."
This example will be based on Centos 5.2 64bit and http 2.2.3 ... in most redhat based systems you should be able to do pretty much the same steps to get this going.
First, you need the src.rpm ... get it from a repo. in my case i got it like this:
wget http://mirror.centos.org/centos/5.3/os/SRPMS/httpd-2.2.3-22.el5.centos.s...
then you have to unpack the src.rpm
rpm -Uvh httpd-2.2.3-22.el5.centos.src.rpm
in my case it complained about a missing path so i had to do:
mkdir /usr/src/redhat
and ran again:
rpm -Uvh httpd-2.2.3-22.el5.centos.src.rpm
this time it worked.
After this operation, you will find the source code stuff in ll /usr/src/redhat/SOURCES/ . you're not really interested on that. what you need is to modify the spec file which is located in /usr/src/redhat/SPECS/
so:
vi /usr/src/redhat/SPECS/httpd.spec
and then change the line
%define contentdir /var/www
to
%define contentdir /home
after that you just need to rebuild the package with:
rpmbuild -bb /usr/src/redhat/SPECS/httpd.spec
in my case it complained of some missing packages. I didn't have rpmbuild so first I did:
yum install rpm-build
and then some httpd recompile related packages were missing:
yum install zlib-devel libselinux-devel pcre-devel openssl-devel distcache-devel autoconf xmlto
you might need different packages so pay attention to what it will require and install accordingly
and then rebuild again:
rpmbuild -bb /usr/src/redhat/SPECS/httpd.spec
and install the generated RPMS:
rpm -Uvh /usr/src/redhat/RPMS/x86_64/httpd-2.2.3-22.x86_64.rpm /usr/src/redhat/RPMS/x86_64/httpd-devel-2.2.3-22.x86_64.rpm /usr/src/redhat/RPMS/x86_64/httpd-manual-2.2.3-22.x86_64.rpm /usr/src/redhat/RPMS/x86_64/mod_ssl-2.2.3-22.x86_64.rpm
when i tried to start apache it played it's last card against me and complained about a missing folder that was set as DocumentRoot.
so you can either change that in /etc/httpd/conf/httpd.conf if you know what you're doing, or you can simply make sure that /var/www/html exists
i had to create that one:
mkdir /var/home/html
and I won :)
Comments
2 comments postedThis helped a lot, thank you!
hey it work, just a few fixed for me;
vi ll /usr/src/redhat/SPECS/httpd.spec should be vi /usr/src/redhat/SPECS/httpd.spec
and mkdir /var/home/html should be mkdir /var/www/html
Post new comment