blob: 1f5b3f431b9df8cfcd8e02361d6882851c2c02f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#!/bin/sh -e
if [ "$1" != "configure" ]; then
exit 0
fi
NETSTAT=netstat
if [ -e /usr/sbin/apache2 ]; then
if [ "`dpkg-statoverride --list /usr/sbin/apache2`" = "" ]; then
chmod +x /usr/sbin/apache2
else
chmod `dpkg-statoverride --list /usr/sbin/apache2 | cut -f 3` /usr/sbin/apache2
fi
fi
mod_is_enabled() {
test -L /etc/apache2/mods-enabled/$1.load
}
# Detect whether this is a new install or an upgrade.
# Ordinarily one just checks $2, but since we renamed apache2-common to
# apache2.2-common, we have to be more devious.
if [ -n "$2" ]; then
UPGRADE=from_2_2
elif [ -e /etc/apache2/ports.conf ] ||
[ -n "$(ls /etc/apache2/sites-enabled/)" ]; then
UPGRADE=from_2_0
else
UPGRADE=new_install
fi
if [ ! -f /etc/apache2/ports.conf ]; then
echo "# 0 = start on boot; 1 = don't start on boot" > /etc/default/apache2
NO_AF_INET=`$NETSTAT -lnt 2>&1 | grep 'no support for .AF INET (tcp)'` || true
NO_PORT_80=`$NETSTAT -lnt | awk '{print $4}' | grep ':80$'` || true
if [ -n "$NO_AF_INET" -o -n "$NO_PORT_80" ]; then
echo "NO_START=1" >> /etc/default/apache2
echo "Listen 80" >> /etc/apache2/ports.conf
if [ -n "$NO_AF_INET" ]; then
echo "netstat is unable to query the state of your listening TCP ports. This could be because you don't have TCP support in your kernel (unlikely), or because you do not have the /proc filesystem mounted. To be on the safe side, we're assuming that port 80 is in use."
fi
echo "Setting Apache2 not to start, as something else appears to be using Port 80. To allow apache2 to start, set NO_START to 0 in /etc/default/apache2. Apache2 has been set to listen on port 80 by default, so please edit /etc/apache2/ports.conf as desired. Note that the Port directive no longer works."
else
echo "NO_START=0" >> /etc/default/apache2
echo "Listen 80" >> /etc/apache2/ports.conf
echo "Setting Apache2 to Listen on port 80. If this is not desired, please edit /etc/apache2/ports.conf as desired. Note that the Port directive no longer works."
fi
fi
#set up default site and dummy error and access logs
if [ $UPGRADE = new_install ]; then
if [ ! -L /etc/apache2/sites-enabled/000-default -a \
! -f /etc/apache2/sites-enabled/000-default ]; then
ln -s /etc/apache2/sites-available/default /etc/apache2/sites-enabled/000-default
fi
touch /var/log/apache2/error.log /var/log/apache2/access.log
chown root:adm /var/log/apache2/error.log /var/log/apache2/access.log
chmod 0640 /var/log/apache2/error.log /var/log/apache2/access.log
if [ ! -f /etc/apache2/conf.d/charset ]; then
echo "AddDefaultCharset UTF-8" > /etc/apache2/conf.d/charset
fi
fi
# Note, this line catches new installs as well as upgrades
if dpkg --compare-versions "$2" lt 2.2.3-3.1; then
a2enmod alias
a2enmod autoindex
a2enmod dir
a2enmod env
a2enmod mime
a2enmod negotiation
a2enmod setenvif
a2enmod status
a2enmod auth_basic
# Those come from mod_auth:
a2enmod authz_default
a2enmod authz_user
a2enmod authz_groupfile
a2enmod authn_file
# This comes from mod_access:
a2enmod authz_host
fi
if [ $UPGRADE = from_2_0 ]; then
# Module replacements from previous versions of apache2
if mod_is_enabled proxy; then
a2enmod proxy_http
a2enmod disk_cache
fi
if mod_is_enabled imap; then
a2dismod imap
a2enmod imagemap
fi
if mod_is_enabled auth_ldap; then
a2dismod auth_ldap
a2enmod authnz_ldap
fi
fi
exit 0
|