Gentoo Archives: gentoo-server

From: Robert Welz <welz@×××××××××.de>
To: gentoo-server@l.g.o
Subject: Re: [gentoo-server] apache chroot
Date: Mon, 28 Aug 2006 19:05:54
Message-Id: 44F33DC5.5000301@fixe-post.de
In Reply to: [gentoo-server] apache chroot by Donatas
1 Donatas wrote:
2 > Hi,
3 >
4 > I'm trying to make mod_cheroot work with apache2.
5 >
6 > # mkdir -p /var/www/localhost/htdocs/var/run
7 > # chown -R root.root /var/www/localhost/htdocs/var/run
8 > # ln -s /var/www/localhost/htdocs/var/run/apache2.pid /var/run/apache2.pid
9 >
10 >
11 >
12 > the main features of httpd.conf:
13 >
14 > PidFile /var/run/apache2.pid
15 > ChrootDir /var/www/localhost/htdocs
16 > DocumentRoot /
17 >
18 > <Directory />
19 > AllowOverride None
20 > Options MultiViews FollowSymLinks
21 > # <IfModule mod_access.c>
22 > # Order allow,deny
23 > # Allow from all
24 > # </IfModule>
25 > <Limit GET OPTIONS>
26 > Order allow,deny
27 > Allow from all
28 > </Limit>
29 > <LimitExcept GET OPTIONS>
30 > Order deny,allow
31 > Deny from all
32 > </LimitExcept>
33 > </Directory>
34 >
35 >
36 >
37 >
38 > /etc/apache2/modules.d/15_mod_chroot.conf:
39 >
40 > <IfDefine CHROOT>
41 > LoadModule chroot_module modules/mod_chroot.so
42 > </IfDefine>
43 >
44 > <IfModule mod_chroot.c>
45 > # change this to the web root
46 > ChrootDir /var/www/localhost/htdocs
47 > </IfModule>
48 >
49 >
50 > /etc/conf.d/apache2
51 >
52 > APACHE2_OPTS="-D USERDIR -D DEFAULT_VHOST -D PHP5 -D SSL -D
53 > SSL_DEFAULT_VHOST -D CHROOT"
54 >
55 >
56 >
57 > After this chroot methot, apache2 starts, but pages cannot be shown.
58 > Time-out.
59 > This happens, when -D CHROOT is added to /etc/conf.d/apache2
60 >
61 >
62 > What's the problem? Maby somebody has working mod_chroot?
63
64
65 mine works:
66 less modules.d/15_mod_chroot.conf:
67
68 <IfDefine CHROOT>
69 LoadModule chroot_module modules/mod_chroot.so
70 </IfDefine>
71
72 <IfModule mod_chroot.c>
73 # change this to the web root
74 ChrootDir /var/www
75 </IfModule>
76
77 and /etc/apache2/vhosts.d/00_default_vhost.conf:
78 <IfDefine DEFAULT_VHOST>
79 <VirtualHost *:80>
80 #
81 # DocumentRoot: The directory out of which you will serve your
82 # documents. By default, all requests are taken from this
83 directory, but
84 # symbolic links and aliases may be used to point to other locations.
85 #
86 DocumentRoot "/localhost/htdocs"
87
88 #
89 # This should be changed to whatever you set DocumentRoot to.
90 #
91 <Directory "/localhost/htdocs">
92
93 #
94 # Possible values for the Options directive are "None", "All",
95 # or any combination of:
96 # Indexes Includes FollowSymLinks SymLinksifOwnerMatch
97 ExecCGI MultiViews
98 #
99
100 There are several directories under /var/www which might be needed if
101 you use php or locales or date and time...
102
103 You find it with google or at the mod_php homepage.
104
105 Robert
106 --
107 gentoo-server@g.o mailing list