|
|
@@ -289,6 +289,8 @@ add_web_config() {
|
|
|
-e "s|%ssl_ca%|$ssl_ca|g" \
|
|
|
> $conf
|
|
|
|
|
|
+ process_http2_directive "$conf"
|
|
|
+
|
|
|
chown root:$user $conf
|
|
|
chmod 640 $conf
|
|
|
|
|
|
@@ -857,6 +859,8 @@ add_webmail_config() {
|
|
|
-e "s|%ssl_ca%|$ssl_ca|g" \
|
|
|
> $conf
|
|
|
|
|
|
+ process_http2_directive "$conf"
|
|
|
+
|
|
|
chown root:$user $conf
|
|
|
chmod 640 $conf
|
|
|
|
|
|
@@ -1018,3 +1022,35 @@ is_base_domain_owner() {
|
|
|
fi
|
|
|
done
|
|
|
}
|
|
|
+
|
|
|
+#----------------------------------------------------------#
|
|
|
+# Process "http2" directive for NGINX #
|
|
|
+#----------------------------------------------------------#
|
|
|
+
|
|
|
+process_http2_directive() {
|
|
|
+ if [ -e /etc/nginx/conf.d/http2-directive.conf ]; then
|
|
|
+ while IFS= read -r old_param; do
|
|
|
+ new_param="$(echo "$old_param" | sed 's/\shttp2//')"
|
|
|
+ sed -i "s/$old_param/$new_param/" "$1"
|
|
|
+ done < <(grep -E "listen.*(\bssl\b(\s|.+){1,}\bhttp2\b|\bhttp2\b(\s|.+){1,}\bssl\b).*;" "$1")
|
|
|
+ else
|
|
|
+ if version_ge "$(nginx -v 2>&1 | cut -d'/' -f2)" "1.25.1"; then
|
|
|
+ echo "http2 on;" > /etc/nginx/conf.d/http2-directive.conf
|
|
|
+
|
|
|
+ while IFS= read -r old_param; do
|
|
|
+ new_param="$(echo "$old_param" | sed 's/\shttp2//')"
|
|
|
+ sed -i "s/$old_param/$new_param/" "$1"
|
|
|
+ done < <(grep -E "listen.*(\bssl\b(\s|.+){1,}\bhttp2\b|\bhttp2\b(\s|.+){1,}\bssl\b).*;" "$1")
|
|
|
+ else
|
|
|
+ listen_ssl="$(grep -E "listen.*\s\bssl\b(?:\s)*.*;" "$1")"
|
|
|
+ listen_http2="$(grep -E "listen.*(\bssl\b(\s|.+){1,}\bhttp2\b|\bhttp2\b(\s|.+){1,}\bssl\b).*;" "$1")"
|
|
|
+
|
|
|
+ if [ -n "$listen_ssl" ] && [ -z "$listen_http2" ]; then
|
|
|
+ while IFS= read -r old_param; do
|
|
|
+ new_param="$(echo "$old_param" | sed 's/\sssl/ ssl http2/')"
|
|
|
+ sed -i "s/$old_param/$new_param/" "$1"
|
|
|
+ done < <(grep -E "listen.*\s\bssl\b(?:\s)*.*;" "$1")
|
|
|
+ fi
|
|
|
+ fi
|
|
|
+ fi
|
|
|
+}
|