Friday Jul 30
English French German Italian Portuguese Russian Spanish Filipino

Using apache2-mpm-itk on Debian Lenny for Virtual Hosting

Attention: open in a new window. PrintE-mail

I had problems trying to make suPHP work on my Debian Lenny server. I have tried re-tried different ways to make it work but all failed. Searching for alternatives on the web I came across this article on how to run vhosts using UID/GID of the web site owner. If a package is available on Ubuntu there is a very good chance it is also available on the Debian software repositories.

Disclaimer: There is no guarantee this will work for you. Created for author's personal use.

Words in italic to be type at the shell prompt.

apt-get update

I like to simulate the installation first.

apt-get install apache2-mpm-itk -s

This will indicate what packages will get installed or removed.

apache2 apache2-mpm-prefork will be removed.

I'm fine with that so now I can procceed with the actual installation.

apt-get install apache2-mpm-itk

After installing the package I now need to add these three lines into my virtual host configuration. I'm using Virtualmin GPL to manage my virtual web sites.

Going into /etc/apache2/sites-available then choosing the virtual host to run using mpm-itk. In this example I have a virtual site called moved.joealdeguer.com opening this with vi or Webmin's file manager I will add these three lines into the configuration file near the bottom just before </VirtualHost> tag. Using the web site owner's username and group as the values for AssignUserID.

<IfModule mpm_itk_module>
AssignUserId joealdeguer joealdeguer
</IfModule>
</VirtualHost>

I want to be able to add these three lines automatically each time I create a new Virtual website using Virtualmin. To do this I went into Virtualmin Virtual Servers (GPL) under the Server menu. Click on the icon Server Templates.

 

server-templates

 

Then click Create a Template from the default settings. I'll give the new template a name which I will call MPM-ITK Enabled, then click create.

 

mpm-itk-template

 

Now that I have a template I will now add the necessarry variables Virtualmin requires to be able to add username/group of the web site owner as well as the mpm-itk configuration lines. Clicking on the new MPM-ITK template I just created then choosing the apache website section.

 

apache-config

 

At the end of the apache directives I will add the following lines. Click save.


<IfModule mpm_itk_module>
AssignUserId ${USER} ${GROUP}
</IfModule>


virtualmin-variables

Whenever I need to create a new vhost using mpm-itk I now have this as a template.

 

create-vhost


Done.

References used:
http://www.howtoforge.com/running-vhosts-under-separate-uids-gids-with-apache2-mpm-itk-on-ubuntu-9.10
http://blog.stuartherbert.com/php/2008/04/19/using-mpm-itk-to-secure-a-shared-server/



Add this page to your favorite Social Bookmarking websites
Digg! Reddit! Del.icio.us! Google! Live! Facebook! StumbleUpon! Yahoo! Joomla Portal

COMMENTS: (Abusing this comment form with spam would be the most effective way to have your IP, network or country blocked!)

Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment