From 1ddc3e99ce82840a02afbb22519e380d0fb897d9 Mon Sep 17 00:00:00 2001 From: Acenl12 <38886380+Acenl12@users.noreply.github.com> Date: Mon, 20 Nov 2023 08:48:15 +0100 Subject: [PATCH] Update chroot-inside-Debian-Live.hook.chroot --- .../chroot-inside-Debian-Live.hook.chroot | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/staging/config/hooks/live/chroot-inside-Debian-Live.hook.chroot b/staging/config/hooks/live/chroot-inside-Debian-Live.hook.chroot index 5c718de73..282b8842d 100755 --- a/staging/config/hooks/live/chroot-inside-Debian-Live.hook.chroot +++ b/staging/config/hooks/live/chroot-inside-Debian-Live.hook.chroot @@ -146,6 +146,40 @@ python3 docker-drag/docker_pull.py ghcr.io/stamusnetworks/arkimeviewer:master mv /opt/selksd/pull/*.tar /opt/selksd/SELKS/docker/tar_images rm -rf /opt/selksd/pull/ + +NGINX_CONFIG="/etc/nginx/sites-available/default" + +# Backup the default Nginx config +sudo cp "$NGINX_CONFIG" "$NGINX_CONFIG.bak" + +# Add HTTP to HTTPS redirect +echo "server { + listen 80 default_server; + listen [::]:80 default_server; + server_name _; + + # Redirect to HTTPS + return 301 https://\$host\$request_uri; +} + +server { + listen 443 ssl default_server; + listen [::]:443 ssl default_server; + + # SSL configurations go here + + root /var/www/html; + index index.html index.htm index.nginx-debian.html; + server_name _; + + location / { + try_files \$uri \$uri/ =404; + } + + # Additional server block configurations go here +}" | sudo tee "$NGINX_CONFIG" > /dev/null + + apt-get autoremove -y apt-get clean && \ cat /dev/null > ~/.bash_history && history -c