Skip to content

Commit b6affa0

Browse files
authored
check if brotli is installed
1 parent 8cf7855 commit b6affa0

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

addons/brotli-nginx.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,27 @@ debug_mode
1919
# Check if root
2020
root_check
2121

22-
# Replace old Nginx with new
23-
install_if_not ppa-purge
24-
ppa-purge nginx/stable
25-
rm -f /etc/apt/sources.list.d/nginx*
26-
check_command yes | add-apt-repository ppa:ondrej/nginx
27-
apt update -q4 && spinner_loading
28-
install_if_not nginx
29-
systemctl stop nginx
30-
systemctl start nginx
31-
systemctl enable nginx
32-
apt-get purge ppa-purge -y
33-
apt-get autoremove -y
22+
# Replace old Nginx with Brotli supported Nginx
23+
if [ ! -f /etc/nginx/modules-enabled/50-mod-http-brotli-filter.conf ]
24+
then
25+
install_if_not ppa-purge
26+
ppa-purge nginx/stable
27+
rm -f /etc/apt/sources.list.d/nginx*
28+
check_command yes | add-apt-repository ppa:ondrej/nginx
29+
apt update -q4 && spinner_loading
30+
install_if_not nginx
31+
systemctl stop nginx
32+
systemctl start nginx
33+
systemctl enable nginx
34+
apt-get purge ppa-purge -y
35+
apt-get autoremove -y
36+
else
37+
exit
38+
fi
3439

3540
# Enable Brotli
3641
install_if_not libnginx-mod-brotli
37-
if ! [ -f /etc/nginx/modules-enabled/50-mod-http-brotli-filter.conf ]
38-
then
39-
echo "load_module modules/ngx_http_brotli_filter_module.so;" > /etc/nginx/modules-enabled/50-mod-http-brotli-filter.conf
40-
fi
42+
echo "load_module modules/ngx_http_brotli_filter_module.so;" > /etc/nginx/modules-enabled/50-mod-http-brotli-filter.conf
4143

4244
# Enable Brotli in config
4345
rm -f /etc/nginx/nginx.conf

0 commit comments

Comments
 (0)