Running Vhosts Under Separate UIDs/GIDs With Apache2 mpm-itk On Ubuntu 9.04
Running Vhosts Under Separate UIDs/GIDs With Apache2 mpm-itk On Ubuntu 9.04Version 1.0 This article explains how you can install and configure apache2-mpm-itk on an Ubuntu 9.04 server. apache2-mpm-itk is an MPM (Multi-Processing Module) for the Apache 2 web server. mpm-itk allows you to run each of your vhost under a separate UID and GID - in short, the scripts and configuration files for one vhost no longer have to be readable for all the other vhosts. mpm-itk works with mod_php because mpm-itk is based on the traditional prefork MPM, which means it's non-threaded. This means you don't need to use suExec or suPHP anymore to run a website's PHP scripts as a separate user. This document comes without warranty of any kind! I do not issue any guarantee that this will work for you!
1 Preliminary NoteI'm assuming you have a working Apache2 installation with mod_php on your Ubuntu 9.04 server. For speed considerations, take a look at http://blog.stuartherbert.com/php/2008/04/19/using-mpm-itk-to-secure-a-shared-server/. For security considerations, please visit http://mpm-itk.sesse.net/. I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root: sudo su
2 Installing apache2-mpm-itkapache2-mpm-itk is available as a .deb package for Ubuntu 9.04, so all we have to do is run aptitude install apache2-mpm-itk
3 Configuring apache2-mpm-itkapache2-mpm-itk is configured on a per-vhost basis, i.e., we don't have to set any global options, and there's only one directive we need to set in a vhost, AssignUserId, which takes two parameters, the user name and the group that the vhost will run as. In this example I will use the default Ubuntu Apache vhost (you can find its configuration in /etc/apache2/sites-available/default) with the document root /var/www (if you have different vhosts, please adjust this to your situation), and I want this vhost to run as the user web1_admin and group web1. If the user and group don't already exist, we can create them as follows: groupadd web1 Then we open our vhost configuration and add the following lines to it:
For example: vi /etc/apache2/sites-available/default
Restart Apache afterwards: /etc/init.d/apache2 restart That's it!
4 Links
|



Recent comments
9 hours 47 min ago
19 hours 41 min ago
1 day 1 hour ago
1 day 6 hours ago
1 day 11 hours ago
1 day 13 hours ago
1 day 14 hours ago
1 day 14 hours ago
1 day 18 hours ago
1 day 18 hours ago