A2CNDIR=/usr/share/apache2-cn
TMPLDIR=$A2CNDIR/templates
CERTDIR=/etc/ssl/certs
-A2PHPINI="/etc/php4/apache2/php.ini"
+A2PHPINI="/etc/php5/apache2/php.ini"
HOST=$(hostname)
FQDN=$(hostname --fqdn)
$conf_file > $out
mv $out $conf_file
fi
+
+ # Be sure..
+ chmod 644 $conf_file
fi
}
# Check if port 443 is configured in ports.conf file.
#
listen_ssl() {
-
- if ! egrep -iq "^[[:space:]]*Listen[[:space:]]*.*443$" "$PORTCONF"; then
+
+ if [ ! -f "$PORTCONF" ] || ! egrep -iq "^[[:space:]]*Listen[[:space:]]*.*443$" "$PORTCONF"; then
cp_echo "CN: Enabling SSL port (443) for Apache2 web server."
out=$(mktemp ${PORTCONF}.XXXXXX)
- cp $PORTCONF $out
+
+ if [ -f "$PORTCONF" ]; then
+ cp $PORTCONF $out
+ fi
+
echo "Listen 443" >> $out
cp_mv $out $PORTCONF
+ chmod 644 $PORTCONF
need_restart=1
temp_files="${temp_files} ${out}"
# Make sure that monit conf for Apache is disabled.
+#
if [ -f "/etc/monit.d/apache1.conf" ]; then
mv /etc/monit.d/apache1.conf /etc/monit.d/apache1.conf.disabled
pkill -9 -f /usr/sbin/monit || true
fi
-# First of all - stop Apache web server, make sure Apache is NOT running.
+# Make sure Apache is NOT running.
#
if [ -x /usr/sbin/invoke-rc.d ]; then
[ -x /usr/sbin/apache ] && invoke-rc.d apache stop || true
fi
-# Enable Apache2 web server modules (cgi, rewrite, userdir, suexec, php4, ssl).
+# Enable Apache2 web server modules (cgi, rewrite, userdir, suexec, php5, ssl).
#
if [ -e "$CONF" ]; then
need_restart=1
fi
- if [ ! -e "$A2MODEDIR/php4.load" ] || [ ! -e "$A2MODEDIR/php4.conf" ]; then
- cp_echo "CN: Enabling PHP4 module for Apache2 web server."
- a2enmod php4 >/dev/null || true
+ if [ ! -e "$A2MODEDIR/php5.load" ] || [ ! -e "$A2MODEDIR/php5.conf" ]; then
+ cp_echo "CN: Enabling PHP5 module for Apache2 web server."
+ a2enmod php5 >/dev/null || true
need_restart=1
fi
# Add VirtualHosts.
#
-db_get apache2-cn/wwwhost || true
-if [ "$RET" = "true" ]; then
+db_fget apache2-cn/wwwhost seen
+if [ "$RET" != "true" ]; then
+
+ db_get apache2-cn/wwwhost || true
+ if [ "$RET" = "true" ]; then
# Add WWW VirtualHost.
if [ -f "$CONFDIR/sites-available/$FQDN" ]; then
install_vhost default www.$DOMAIN www.$DOMAIN
need_restart=1
fi
-else
+ else
# No WWW VirtualHost.
if [ -f "$CONFDIR/sites-available/$FQDN" ]; then
install_vhost -nvh -d -r $FQDN default $FQDN 000-$FQDN
need_restart=1
fi
+ fi
fi
# SSLCertificateChainFile
if [ -n "$apache2_sslccf" ]; then
- cp_check_and_sed "^# SSLCertificateChainFile \/etc\/ssl\/certs/sureserverEDU\.pem" \
- "s#\# SSLCertificateChainFile /etc/ssl/certs/sureserverEDU.pem#SSLCertificateChainFile $apache2_sslccf #g" \
- $SSLTMP || true
+ cp_check_and_sed "^# SSLCertificateChainFile \/etc\/ssl\/certs/sureserverEDU\.pem" \
+ "s#\# SSLCertificateChainFile /etc/ssl/certs/sureserverEDU.pem#SSLCertificateChainFile $apache2_sslccf #g" \
+ $SSLTMP || true
fi
cp_mv $SSLTMP ${CONFDIR}/sites-available/ssl