Last modified 2 years ago
Peruser MPM Installation on Debian
Installation
cd /usr/src/ apt-get install dpkg-dev apache2-src libaprutil1-dev libcap2-dev autoconf debhelper build-essential fakeroot dpatch apache2-prefork-dev libcap2-dev autoconf apt-get source apache2-mpm-itk mv apache2-mpm-itk-2.2.6-02 apache2-mpm-peruser-0.3.0.dc3-01 rm -f apache2-mpm-itk* cd apache2-mpm-peruser-0.3.0.dc3-01 cd patches rm -f * wget -O httpd-2.2.3-peruser-0.3.0.patch "http://www.peruser.org/trac/projects/peruser/attachment/wiki/PeruserAttachments/httpd-2.2.3-peruser-0.3.0.patch?format=raw" wget -O httpd-2.2.3-peruser-0.3.0-dc3.patch http://www.peruser.org/trac/projects/peruser/attachment/wiki/PeruserAttachments/httpd-2.2.3-peruser-0.3.0-dc3.patch?format=raw cd ../debian/ mv apache2-mpm-itk.dirs apache2-mpm-peruser.dirs mv apache2-mpm-itk.postinst apache2-mpm-peruser.postinst mv apache2-mpm-itk.preinst apache2-mpm-peruser.preinst mv apache2-mpm-itk.prerm apache2-mpm-peruser.prerm echo '' > changelog vi changelog
debian/changelog
apache2-mpm-peruser (0.3.0.dc3-01-1) stable; urgency=low * Initial port to Apache 2.2. -- Stefan Klingner <stefan.klingner@mephisto23.com> Wed, 11 Mar 2009 15:25:36 +0100
echo '' > control vi control
debian/control
Source: apache2-mpm-peruser
Section: net
Priority: extra
Build-Depends: apache2-src (>= 2.2.9), libaprutil1-dev, libcap2-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], autoconf, debhelper (>> 5.0.0)
Maintainer: Stefan Klingner <stefan.klingner@mephisto23.com>
Standards-Version: 3.7.3
Package: apache2-mpm-peruser
Provides: apache2-mpm, apache2, httpd, httpd-cgi
Conflicts: apache2-mpm, apache2-common
Depends: ${apache:Depends}, ${shlibs:Depends}
Architecture: any
Description: multiuser MPM for Apache 2.2
The Peruser Multi-Processing Module (MPM) works in about the same way as the
classical "prefork" module (that is, without threads), except that it allows
you to constrain each individual vhost to a particular system user. This
allows you to run several different web sites on a single server without
worrying that they will be able to read each others' files.
Please note that this MPM is somewhat less tested than the MPMs that come with
Apache itself.
echo '' > rules vi rules
debian/rules
#! /usr/bin/make -f clean: dh_testdir dh_testroot dh_clean $(RM) -r build-tree/ $(RM) -r apache2/ $(RM) build-stamp build: build-stamp build-arch: build-stamp build-stamp: dh_testdir mkdir build-tree/ mkdir apache2/ tar zxf /usr/src/apache2.tar.gz cd apache2/ && patch -p1 < ../patches/httpd-2.2.3-peruser-0.3.0.patch cd apache2/ && patch -p1 < ../patches/httpd-2.2.3-peruser-0.3.0-dc3.patch cd apache2/ && autoconf sed 's,prefork,peruser,;s,^".*/configure",../apache2/configure,;s,^"--srcdir=.*",--srcdir=../apache2/,' < /usr/share/apache2/build/config.nice > build-tree/config.nice chmod +x build-tree/config.nice cd build-tree/ && ./config.nice cd build-tree/ && $(MAKE) touch build-stamp binary: binary-arch binary-indep: binary-arch: build-arch dh_testdir dh_testroot dh_installdirs install -m 0755 build-tree/apache2 debian/apache2-mpm-peruser/usr/sbin/ dh_fixperms dh_strip dh_installdocs README dh_installchangelogs dh_installdeb dh_compress dh_shlibdeps echo "apache:Depends=apache2.2-common (= `dpkg -s apache2.2-common | grep ^Version: | cut -d" " -f2`)" >> debian/apache2-mpm-peruser.substvars dh_gencontrol dh_md5sums dh_builddeb .PHONY: clean build build-arch binary binary-arch binary-indep
All space in front of line must be tab. Now we can start to build the package:
cd .. dpkg-buildpackage cd .. dpkg -i apache2-mpm-peruser*.deb
Lean back, drink a coffee, possibly smoke a cigarette and enjoy that you have accomplished one great step forward your fast and secure shared hosting server. :)
Configuration
/etc/apache2/apache2.conf
# peruser MPM
<IfModule peruser.c>
# Multiplexer pool
MinMultiplexers 3
MaxMultiplexers 20
Multiplexer ${APACHE_RUN_USER} ${APACHE_RUN_GROUP}
ProcessorWaitTimeout 2 10
# Fork limits
ServerLimit 20
MaxClients 20
MaxRequestsPerChild 1000
# Processor defaults
MinProcessors 0
MinSpareProcessors 3
MaxProcessors 10
# Timeouts
IdleTimeout 60
ExpireTimeout 300
</IfModule>
# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
/etc/apache2/conf.d/mpm-peruser
<IfModule peruser.c> <Processor bob> User bob Group www </Processor> </IfModule>
/etc/apache2/sites-enabled/X
<VirtualHost X> <IfModule peruser.c> ServerEnvironment bob </IfModule> </VirtualHost>
PHP
In order to get libapache2-mod-php5 running with peruser, you have to rebuild the package with correct dependencies.
cd /usr/src/ apt-get install automake1.4 bison chrpath firebird2.0-dev flex freetds-dev libbz2-dev libc-client-dev libcurl4-openssl-dev libfreetype6-dev libgcrypt11-dev libgd2-xpm-dev libgmp3-dev libjpeg62-dev libmcrypt-dev libmhash-dev libncurses5-dev libpam0g-dev libpng12-dev libpspell-dev librecode-dev libsasl2-dev libsnmp-dev libsqlite0-dev libt1-dev libtidy-dev libtool libwrap0-dev libxmltok1-dev libxml2-dev libxslt1-dev quilt re2c unixodbc-dev apt-get source php5 cd php5-5.2.6*/debian/ sed -e 's/itk/itk|apache2-mpm-peruser/g' -i rules cd .. dpkg-buildpackage dpkg -i libapache2-mod-php5*.deb
