Skip to content

Commit

Permalink
Change Nginx PPA (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
enoch85 authored Oct 2, 2024
1 parent af50722 commit c6604be
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
12 changes: 10 additions & 2 deletions lets-encrypt/activate-tls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ fi
# To get the correct version for the Nginx conf file
check_php

# Check Brotli support
if is_this_installed libnginx-mod-brotli
then
BROTLI_ON="brotli on;"
fi

# Generate wordpress_tls_domain.conf
if [ ! -f "$tls_conf" ]
then
Expand All @@ -118,8 +124,10 @@ server {
return 301 https://$TLSDOMAIN\$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
$BROTLI_ON
## Your website name goes here.
server_name $TLSDOMAIN;
Expand Down
4 changes: 4 additions & 0 deletions static/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# https://docs.nginx.com/nginx/admin-guide/dynamic-modules/brotli/
load_module modules/ngx_http_brotli_filter_module.so; # for compressing responses on-the-fly
load_module modules/ngx_http_brotli_static_module.so; # for serving pre-compressed files

user www-data;
worker_processes 2;
pid /run/nginx.pid;
Expand Down
14 changes: 11 additions & 3 deletions wordpress_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ install_if_not build-essential
# Needed for cron(tab)
install_if_not cron

# For TAB completion
install_if_not bash-completion

# Set DNS resolver
# https://unix.stackexchange.com/questions/442598/how-to-configure-systemd-resolved-and-systemd-networkd-to-use-local-dns-server-f
while :
Expand Down Expand Up @@ -246,13 +249,16 @@ run_script STATIC new_etc_mycnf
install_if_not open-vm-tools

# Install Nginx
check_command yes | add-apt-repository ppa:nginx/stable
check_command yes | add-apt-repository ppa:ondrej/nginx
apt update -q4 && spinner_loading
install_if_not nginx
sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl enable nginx.service

# Enable Brotli
install_if_not libnginx-mod-brotli

# Download TLSv 1.3 modified nginx.conf
rm -f /etc/nginx/nginx.conf
curl_to_dir "$STATIC" nginx.conf /etc/nginx/
Expand Down Expand Up @@ -542,8 +548,10 @@ then
touch "$SITES_AVAILABLE/$TLS_CONF"
cat << TLS_CREATE > "$SITES_AVAILABLE/$TLS_CONF"
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
brotli on;
## Your website name goes here.
# server_name example.com;
Expand Down

0 comments on commit c6604be

Please sign in to comment.