[Bug 627227] [NEW] ChrootDir(mpm_common) and DocumentRoot issues

dmitri.g 627227 at bugs.launchpad.net
Tue Aug 31 05:50:36 BST 2010


Public bug reported:

Binary package hint: apache2

Description:	Ubuntu 10.04.1 LTS
Release:	10.04
apache2:
  Installed: 2.2.14-5ubuntu8
apache2-mpm-prefork:
  Installed: 2.2.14-5ubuntu8

Setting document root to a folder inside the chroot provided by
mpm_common
(http://httpd.apache.org/docs/2.2/mod/mpm_common.html#chrootdir)

directory structure:

/var/www/example.com <--chrootdir
    /conf
        /apache2.conf
        /apache2.pid
        /apache2.lock
    /log
        /error.log
    /lib
        /inc.php
    /web <-- documentroot
        /index.php <-- this just includes ../inc.php
        
apache2.conf:
    ChrootDir /var/www/example.com/
    ServerRoot /var/www/example.com/
    LockFile /var/www/example.com/conf/accept.lock
    PidFile /var/www/example.com/conf/apache2.pid
    Timeout 300
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 15
    User example
    Group example
    DefaultType text/plain
    HostnameLookups Off
    ErrorLog /var/www/example.com/conf/error.log
    LogLevel warn
    Include /etc/apache2/mods-enabled/*.load
    Include /etc/apache2/mods-enabled/*.conf
    Listen 8080
    # apache fails to start complains document root doesnt exist
    DocumentRoot /web
    
    # apache starts, requests fail
    #
    # DocumentRoot web   
     
    # apache starts, requests fail (cant find /var inside chroot)
    #
    # DocumentRoot /var/www/example.com/web
    
    # apache starts, requests work but php cant load inc.php  (docroot==chroot)
    # (this only works because / actually exists in the filesystem)
    #
    # ChrootDir /var/www/example.com/web/
    # DocumentRoot /

Apache fails to start with "DocumentRoot doesn't exists" error, from
strace output it seems apache does a stat/stat64 on documentroot before
it chroots itself, then does it again before serving pages once request
comes in.

Workaround:
Making empty "web" directory in / tricks apache into starting and servering requests, as well as php include working as expected.

** Affects: apache2 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
ChrootDir(mpm_common) and DocumentRoot issues
https://bugs.launchpad.net/bugs/627227
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to apache2 in ubuntu.



More information about the Ubuntu-server-bugs mailing list