Enable HTTP/2 server wide (#349)

This commit is contained in:
MichaIng 2017-08-26 09:48:40 +02:00 committed by Daniel Hansson
parent cfce35c43b
commit ea1c6c6899
2 changed files with 27 additions and 0 deletions

1
lib.sh
View File

@ -57,6 +57,7 @@ PHPMYADMIN_CONF="/etc/apache2/conf-available/phpmyadmin.conf"
SECURE="$SCRIPTS/setup_secure_permissions_nextcloud.sh"
SSL_CONF="/etc/apache2/sites-available/nextcloud_ssl_domain_self_signed.conf"
HTTP_CONF="/etc/apache2/sites-available/nextcloud_http_domain_self_signed.conf"
HTTP2_CONF="/etc/apache2/mods-available/http2.conf"
# Nextcloud version
[ ! -z "$NC_UPDATE" ] && CURRENTVERSION=$(sudo -u www-data php $NCPATH/occ status | grep "versionstring" | awk '{print $3}')
NCVERSION=$(curl -s -m 900 $NCREPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' | sort --version-sort | tail -1)

View File

@ -415,6 +415,32 @@ fi
a2ensite nextcloud_ssl_domain_self_signed.conf
a2ensite nextcloud_http_domain_self_signed.conf
a2dissite default-ssl
# Enable HTTP/2 server wide, if user decides to
echo "Your official package repository does not provide an Apache2 package with HTTP/2 module included."
echo "If you like to enable HTTP/2 nevertheless, we can upgrade your Apache2 from Ondrejs PPA:"
echo "https://launchpad.net/~ondrej/+archive/ubuntu/apache2"
echo "Enabling HTTP/2 can bring a performance advantage, but may also have some compatibility issues."
echo "E.g. the Nextcloud Spreed video calls app does not yet work with HTTP/2 enabled."
if [[ "yes" == $(ask_yes_or_no "Do you want to enable HTTP/2 system wide?") ]]
then
# Adding PPA
add-apt-repository ppa:ondrej/apache2 -y
apt update -q4 & spinner_loading
apt upgrade apache2 -y
# Enable HTTP/2 module & protocol
cat << HTTP2_ENABLE > "$HTTP2_CONF"
<IfModule http2_module>
Protocols h2 h2c http/1.1
H2Direct on
</IfModule>
HTTP2_ENABLE
echo "$HTTP2_CONF was successfully created"
a2enmod http2
fi
# Restart Apache2 to enable new config
service apache2 restart
whiptail --title "Which apps/programs do you want to install?" --checklist --separate-output "" 10 40 3 \