From a0ceec523d74d1bbd74076693891ccf7654c166e Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Sun, 19 May 2019 17:27:36 +0200 Subject: [PATCH] Turn off ServerTokens for both Apache and PHP --- nextcloud_install_production.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nextcloud_install_production.sh b/nextcloud_install_production.sh index fbc1905e..1ffad828 100644 --- a/nextcloud_install_production.sh +++ b/nextcloud_install_production.sh @@ -222,7 +222,19 @@ a2enmod rewrite \ # We don't use Apache PHP (just to be sure) a2dismod mpm_prefork - + +# Disable server tokens in Apache +if [[ -z "$(grep 'ServerSignature' /etc/apache2/apache2.conf)" ]] +then +{ +echo "# Turn off ServerTokens for both Apache and PHP" +echo "ServerSignature Off" +echo "ServerTokens Prod" +} >> /etc/apache2/apache2.conf + + check_command systemctl restart apache2.service +fi + # Install PHP "$PHPVER" apt update -q4 & spinner_loading check_command apt install -y \