Skip to content

Commit 8bdcbde

Browse files
authored
better implementation
Signed-off-by: Daniel Hansson <[email protected]>
1 parent 18cc014 commit 8bdcbde

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

lets-encrypt/activate-tls.sh

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,23 @@ fi
131131
# Install Brotli
132132
if version 24.04 "$DISTRO" 26.04.10
133133
then
134-
install_if_not brotli
135-
a2enmod brotli
134+
if [ -z /etc/apache2/conf-available/brotli.conf ]
135+
then
136+
# Install needed packaages
137+
install_if_not brotli
138+
139+
# Add the config
140+
{
141+
echo "# Brotli support"
142+
echo "<IfModule mod_brotli.c>"
143+
echo " AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/json application/x-font-ttf application/vnd.ms-fontobject image/x-icon"
144+
echo "</IfModule>"
145+
} > /etc/apache2/conf-available/brotli.conf
146+
147+
# Enable the config
148+
a2enmod brotli
149+
a2enconf brotli
150+
fi
136151
fi
137152

138153
# Generate nextcloud_tls_domain.conf
@@ -157,11 +172,6 @@ then
157172
<FilesMatch "\.php$">
158173
SetHandler "proxy:unix:/run/php/php$PHPVER-fpm.nextcloud.sock|fcgi://localhost"
159174
</FilesMatch>
160-
161-
# Brotli support
162-
<IfModule mod_brotli.c>
163-
AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/json application/x-font-ttf application/vnd.ms-fontobject image/x-icon
164-
</IfModule>
165175
166176
# Intermediate configuration
167177
Header add Strict-Transport-Security: "max-age=15552000;includeSubdomains"

0 commit comments

Comments
 (0)