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.
This commit is contained in:
Ludovic Poujol 2019-08-21 12:05:37 +02:00
parent b148cf1176
commit f7659cee6d
2 changed files with 7 additions and 3 deletions

View File

@ -8,8 +8,10 @@
DocumentRoot HOME_DIR/XXX/www/ DocumentRoot HOME_DIR/XXX/www/
# SSL # 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 # Propriete du repertoire
<Directory HOME_DIR/XXX/www/> <Directory HOME_DIR/XXX/www/>
#Options +Indexes +SymLinksIfOwnerMatch #Options +Indexes +SymLinksIfOwnerMatch
@ -67,4 +69,3 @@
#php_value default_charset ISO-8859-15 #php_value default_charset ISO-8859-15
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f www-XXX" 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" php_admin_value open_basedir "/usr/share/php:HOME_DIR/XXX:/tmp"

View File

@ -438,6 +438,9 @@ EOT
random=$RANDOM random=$RANDOM
if [ "$WEB_SERVER" == "apache" ]; then 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" 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" sed -e "s/XXX/$in_login/g ; s/SERVERNAME/$in_wwwdomain/ ; s/RANDOM/$random/ ; s#HOME_DIR#$HOME_DIR#" < $TPL_VHOST > "$vhostfile"