View Full Version : Fedora 17 with LAMP - Virtual Hosts with Home User Privileges HOWTO

9th December 2012, 01:23 PM

I just installed Fedora 17 and configured Apache MySql Php with Virtual Hosts using Home User Privileges in a Developper's environment and I would like to share it:

In Fedora 18, this setup is not working for the moment, since httpd-itk.2.4 has not yet been available through yum. (Check post#4 (http://forums.fedoraforum.org/showthread.php?t=286573#4) for a workaround solution)

1) Install LAMP (http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-fedora-18-lamp)

2) Configure Apache UserDir and setup selinux (http://www.if-not-true-then-false.com/2010/enable-apache-userdir-with-selinux-on-fedora-centos-red-hat-rhel/) to allow users install a website on a directory they own.

3) Install httpd-itk to allow apache running a virtual host as owner's "user:group" :

yum install httpd-itk

Follow the instructions:

cat /usr/share/doc/*itk*/README.Fedora
It is only additional MPM for Apache web server.

To enable it:
1) If you are use moderm systemd:
systemctl stop httpd.service
systemctl disable httpd.service
systemctl enable httpd-itk.service
systemctl start httpd-itk.service

2) If you are still using old sysvinit style:
Set HTTPD=/usr/sbin/httpd.itk in /etc/sysconfig/httpd and restart daemon:
service httpd restart

For more information about Apache refer to man and manuals in main httpd package

4) Create Virtual Hosts (http://www.rackspace.com/knowledge_center/article/fedora-apache-virtual-hosts)

5) Enable apache to run as user:group

<VirtualHost *:80>
ServerAdmin xxx
DocumentRoot /xxx/xxx/xxx/
ServerName test.loc
ServerAlias test.loc *.test.loc
ErrorLog xxx
CustomLog xxx

ErrorDocument 403 /403.html
ErrorDocument 404 /404.html

ScriptAlias /cgi-bin/ "xxx/cgi-bin/"
<Directory "/xxx/cgi-bin/">
AllowOverride None
Options None
Order allow,deny
Allow from all
AssignUserId user group

* The above example was pasted from this post (http://www.mjmwired.net/resources/mjm-apache-virtual-sites.html)

6) Don't forget to update /etc/hosts :

cat /etc/hosts localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6 test

And creat a separate virtual host for phpmyadmin:

<VirtualHost *:80>
DocumentRoot /usr/share/phpMyAdmin
ServerName phpmyadmin

7) Restart and enjoy:

systemctl start httpd-itk.service

Kind regards,

9th December 2012, 03:17 PM
Move to Guides and Solutions.

15th January 2013, 04:39 PM
thx for sharing

13th February 2013, 12:59 PM

After upgrading to Fedora 18, the issue that rises is that httpd-itk.2.4 has not yet been available through yum because it is not properly tested.

According to http://mpm-itk.sesse.net/:

There is also a 2.4.4-03 for Apache 2.4 and 2.5.x-pre, last updated 2012-12-31, but it's not as widely tested, so you should exercise some caution. You can download the archive here (the 2.4 series can be built out-of-tree in some cases, so you may no longer have to patch Apache).

Indeed, in fedora's prompt:

yum list installed | grep http
httpd.x86_64 2.4.3-12.fc18 @fedora
httpd-itk.x86_64 2.2.22-8.fc18 @fedora
httpd-manual.noarch 2.4.3-12.fc18 @fedora
httpd-tools.x86_64 2.4.3-12.fc18 @fedora

On the other hand, downgrading apache seems to be difficult, as the relevant post for an according compatibility issue in zend framework states clearly:


...I found it pretty difficult to downgrade to Apache 2.2. Installing it from another RPM breaks a bunch of dependencies.

My choice is to wait until httpd-itk.2.4 gets into yum since -for the time being- I am not entirely fond of tackling deeply with my system due to time constraints regarding my job. Actually, this is the reason why I migrated from gentoo (http://www.gentoo.org/) to fedora ...

However, if a sound solution for fedora 18 is posted, I will surely follow!

In the meantime, I will arrange my server to run as a global preferred user, which is different than the default. Therefore, I will follow the instructions on arranging for the proper arrangements as stated in the following link:


1. Change User and Group to your new user in /etc/httpd/conf/httpd.conf

2. Change the user and group on some things:

chown -R user:group /var/www
chown -R user:group /var/lib/php
chown -R user:group /var/log/httpd
chown -R user:group /var/lib/php/session

3. Restart Apache:
service httpd restart

Kind regards,