#
listen_ssl() {
- if [ ! -f "$PORTCONF" ] || ! 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."
chk_conf_tag "$CONFDIR/sites-available/$FQDN"
if [ ! -f "$CONFDIR/sites-available/$FQDN" ] || [ $RET -eq 0 ]; then
- install_vhost -nvh -d -r www.$DOMAIN default $FQDN 000-$FQDN
+ if egrep -qi "^[[:space:]]*NameVirtualHost[[:space:]]+\*:80$" "$PORTCONF"; then
+ install_vhost -d -r www.$DOMAIN default $FQDN 000-$FQDN
+ else
+ install_vhost -nvh -d -r www.$DOMAIN default $FQDN 000-$FQDN
+ fi
need_restart=1
fi
chk_conf_tag "$CONFDIR/sites-available/$FQDN"
if [ ! -f "$CONFDIR/sites-available/$FQDN" ] || [ $RET -eq 0 ]; then
- install_vhost -nvh -d -r $FQDN default $FQDN 000-$FQDN
+ if egrep -qi "^[[:space:]]*NameVirtualHost[[:space:]]+\*:80$" "$PORTCONF"; then
+ install_vhost -d -r $FQDN default $FQDN 000-$FQDN
+ else
+ install_vhost -nvh -d -r $FQDN default $FQDN 000-$FQDN
+ fi
need_restart=1
fi
fi
# No active SSL VirtualHosts found - add new one.
chk_conf_tag "$CONFDIR/sites-available/ssl"
if [ ! -f "$CONFDIR/sites-available/ssl" ] || [ $RET -eq 0 ]; then
- install_vhost -r $FQDN -n $HOST ssl ssl 001-ssl
+
+ db_get apache2-cn/wwwhost || true
+ if [ "$RET" = "true" ]; then
+ install_vhost -r www.$DOMAIN -n $HOST ssl ssl 001-ssl
+ else
+ install_vhost -r $FQDN -n $HOST ssl ssl 001-ssl
+ fi
need_restart=1
fi
fi
if [ -e "$sitesendir/$site" ]; then
cp_echo "CN: Disabling $site site configuration."
- a2dissite $site >/dev/null || true
+ rm -f $sitesendir/$site
fi
done
fi