How to change suexec root directory from "/var/www" to "/home"?
Hi I've installed suexec using on ubuntu 12.04:
apt-get install apache2 apache2-suexec libapache2-mod-fcgid php5-cgi
However when I run the following command:
sudo /usr/lib/apache2/suexec -V
I get the following info:
-D AP_DOC_ROOT="/var/www"
-D AP_GID_MIN=100
-D AP_HTTPD_USER="www-data"
-D AP_LOG_EXEC="/var/log/apache2/suexec.log"
-D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D AP_UID_MIN=100
-D AP_USERDIR_SUFFIX="public_html"
I'm utilizing "/home/user/public_html" to serve users content on the web not "/var/www" How can I change the root directory to "/home"?
Solution 1:
You're using ubuntu. Therefore recompile is pretty simple.
Add source repository to your /etc/apt/sources.list . For 12.04 run
echo "deb-src http://de.archive.ubuntu.com/ubuntu/ precise main"|sudo tee -a /etc/apt/sources.list
change de.archive.ubuntu.com
to whatever country you're in. After that update your repository.
apt-get update
Change dir and download sources:
mkdir ~/apache_new ; cd ~/apache_new
apt-get source apache2
apt-get build-dep apache2
It will download and extract apache source and install all dependencies therefore you'll be able to build apache.
But you'll need to fix AP_DOC_ROOT. So cd to dir with apache source and change dir path in --with-suexec-docroot
option in debian/rules
file.
So now you'll need to build package. You can make it with
debuild -us -uc
That's it. Now yyou have apache deb-package with fixed path. Just install it with sudo dpkg -i
.
But watch on updates. Update will wipe out all your efforts. So run aptitude hold apache2
to forbid updates and don't forget to recompile it each time manually (or write script fpr that).
Good luck.
Solution 2:
Or you can
apt-get install apache2-suexec-custom
after install go to
cd /etc/apache2/suexec
edit the file vi www-data
You can see the first 2 lines, make the changes: replace /var/www
with /home
esc
:wq
after, restart apache
/etc/init.d/apache2 restart