I'm trying to configure Debian 6.0.4 for massive shared hosting with PHP5.
Packages apache2-mpm-worker libapache2-mod-fcgid apache2-suexec
are installed.
I successfully loaded mod_vhost_alias
and suexec
to manage my domains by directory, then I placed this configuration in /etc/apache2/sites-enabled/001-vhostalias
:
NameVirtualHost *:80
ServerName web-test.mynet.lan
DocumentRoot /var/www/
SuexecUserGroup www-data www-data
UseCanonicalName Off
VirtualDocumentRoot /var/www/www.%2+/public_html/
VirtualScriptAlias /var/www.%2+/cgi-bin/
DirectoryIndex index.html index.htm index.shtml index.php
ScriptAlias /__php5-cgi/ "/usr/local/lib/custom-cgi/php5-cgi/"
Action php5-script /__php5-cgi/php5-cgi
AddHandler php5-script .php
With this above, p. e., putting online a domain named www.test-a.com
needs:
- an
adduser test-a.com
(forcing badname) mkdir -p /var/www/www.test-a.com/public_html
and putting data- files a
chmod
and achown
and everything works fine...
Without suEXEC I made some simple PHP tests, it works fine as uid/gid www-data
. But now I need to enable suEXEC for isolate domains...
The question is: how can I tell to suEXEC to get automatically the right uid/gid?
I'm using the default suEXEC configuration:
root@web-test:/var/www# /usr/lib/apache2/suexec -V
-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"
But it crashes:
root@web-test:/var/www# tail /var/log/apache2/suexec.log
[2012-05-05 18:31:48]: cannot run as forbidden uid (33/php5-cgi)
[2012-05-05 18:34:24]: uid: (33/www-data) gid: (33/www-data) cmd: php5-cgi
Note: I previously used apache2-mpm-itk
but it's quite unstable after 400-500 VirtualHost definitions, especially it crashes on apache2ctl restart|graceful"
.
Thanks