From f7659cee6de9c6f137b752d3ebd9b554a4bfdce6 Mon Sep 17 00:00:00 2001 From: Ludovic Poujol Date: Wed, 21 Aug 2019 12:05:37 +0200 Subject: [PATCH] Fix IncludeOptional that can throw syntax errors in some cases. With Apache < 2.4.30, IncludeOptional will throw syntax errors if the file designated without any pattern globbing is absent. We circumvent that with a silly pattern. --- scripts/vhost | 7 ++++--- scripts/web-add.sh | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/vhost b/scripts/vhost index 970807f..d5b8f4a 100644 --- a/scripts/vhost +++ b/scripts/vhost @@ -8,8 +8,10 @@ DocumentRoot HOME_DIR/XXX/www/ # SSL - IncludeOptional /etc/apache2/ssl/XXX.conf - + # Apache < 2.4.30 (Jessie, Stretch) va générer une erreur si le fichier + # désigné sans regex n'existe pas. On contourne ça avec [f] à place de f + IncludeOptional /etc/apache2/ssl/XXX.con[f] + # Propriete du repertoire #Options +Indexes +SymLinksIfOwnerMatch @@ -67,4 +69,3 @@ #php_value default_charset ISO-8859-15 php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f www-XXX" php_admin_value open_basedir "/usr/share/php:HOME_DIR/XXX:/tmp" - diff --git a/scripts/web-add.sh b/scripts/web-add.sh index 876209a..811314d 100755 --- a/scripts/web-add.sh +++ b/scripts/web-add.sh @@ -438,6 +438,9 @@ EOT random=$RANDOM if [ "$WEB_SERVER" == "apache" ]; then + # On s'assure que /etc/apache2/ssl pour le IncludeOptional de la conf + mkdir -p /etc/apache2/ssl + vhostfile="/etc/apache2/sites-available/${in_login}.conf" sed -e "s/XXX/$in_login/g ; s/SERVERNAME/$in_wwwdomain/ ; s/RANDOM/$random/ ; s#HOME_DIR#$HOME_DIR#" < $TPL_VHOST > "$vhostfile"