After I finished install and config APACHE2, then install the package libapache2-mod-chroot, it is a very simple tool to make a jail for APACHE2 and cost little resource.
1. install the package
apt-get install libapache2-mod-chroot
2. config it.
cat > /etc/apache2/mods-available/mod_chroot.conf
# mod_chroot
<IfModule mod_chroot.c>
LoadFile /lib/libgcc_s.so.1
ChrootDir /chroot/dir/
DocumentRoot /
</IfModule>
^D
3. make a symblo link
ln -s /etc/apache2/mods-available/mod_chroot.conf /etc/apache2/mods-enabled/
ln -s /etc/apache2/mods-available/mod_chroot.load /etc/apache2/mods-enabled/
4. make the directory
mkdir -p /chroot/dir/var/run
mkdir /chroot/dir/var/www
5. make another symblo link
ln -s /chroot/dir/var/run/apache2.pid /var/run/apache2.pid
6. test wether it works
apache2ctl start
now I think it is not a good idea to use it, for I can not run any cgi.
so I decide to remove it.
1. install the package
apt-get install libapache2-mod-chroot
2. config it.
cat > /etc/apache2/mods-available/mod_chroot.conf
# mod_chroot
<IfModule mod_chroot.c>
LoadFile /lib/libgcc_s.so.1
ChrootDir /chroot/dir/
DocumentRoot /
</IfModule>
^D
3. make a symblo link
ln -s /etc/apache2/mods-available/mod_chroot.conf /etc/apache2/mods-enabled/
ln -s /etc/apache2/mods-available/mod_chroot.load /etc/apache2/mods-enabled/
4. make the directory
mkdir -p /chroot/dir/var/run
mkdir /chroot/dir/var/www
5. make another symblo link
ln -s /chroot/dir/var/run/apache2.pid /var/run/apache2.pid
6. test wether it works
apache2ctl start
now I think it is not a good idea to use it, for I can not run any cgi.
so I decide to remove it.