diff --git a/Dockerfile b/Dockerfile index a8189be7db8c5f3d78b45e81da5a5b5b809bb9b4..6e0b25d6b8153d0a77a5392bbb7a9b1969594500 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ FROM nginx:1.23.2-alpine -ARG TRANSMISSION # hadolint ignore=DL3018 RUN rm -rf /etc/nginx/conf./* && \ chmod 777 /run && \ @@ -16,8 +15,7 @@ RUN rm -rf /etc/nginx/conf./* && \ -keyout /var/ssl/site.key \ -nodes \ -out /var/ssl/site.crt \ - -days 2 \ - -subj "/C=US/ST=IL/L=None/O=None/OU=None/CN=localhost/" && \ + -batch && \ cp /var/ssl/site.crt /var/ssl/mail.crt && \ cp /var/ssl/site.key /var/ssl/mail.key && \ setcap CAP_NET_BIND_SERVICE=+ep "$(command -v nginx)" && \ @@ -25,11 +23,6 @@ RUN rm -rf /etc/nginx/conf./* && \ COPY www/ /var/www/ COPY conf.d/ /etc/nginx/conf.d/ COPY snippets/ /etc/nginx/snippets/ -# Another option would be to copy the file to the template directory and have -# the environment variable substitution happen in runtime, but that way would -# miss checking the syntax during the build process. -# hadolint ignore=SC2097,SC2098 -RUN TRANSMISSION=$TRANSMISSION sed -i "s/TRANSMISSION/$TRANSMISSION/" /etc/nginx/conf.d/www.shore.co.il.conf USER nginx RUN nginx -t HEALTHCHECK CMD curl --fail --verbose --user-agent 'Docker health check' --header "Host: status" http://localhost/ || exit 1 diff --git a/conf.d/shore.co.il.conf b/conf.d/shore.co.il.conf index 48c587ef37038cc60f7b7656766f38bdf6c9d747..437a1da370e93778eefaf7805974bea691f3f727 100644 --- a/conf.d/shore.co.il.conf +++ b/conf.d/shore.co.il.conf @@ -27,5 +27,5 @@ server { include snippets/z-push.conf; location = / { return 301 https://www.shore.co.il/blog/; } - location / { return 301 https://www.shore.co.il$request_uri; } + include snippets/redirect-www.conf; } diff --git a/conf.d/www.shore.co.il.conf b/conf.d/www.shore.co.il.conf index 7200f5ae04bb3b63278417c3366531e904940ee3..cd62489e86e6a8b5cd63e7b590b35d7cf82a924d 100644 --- a/conf.d/www.shore.co.il.conf +++ b/conf.d/www.shore.co.il.conf @@ -1,6 +1,3 @@ -map $host $lam { default ldap-account-manager; } -map $host $kodi { default kodi.shore.co.il; } - server { listen 80; listen [::]:80; @@ -43,31 +40,4 @@ server { location /cgit/ { return 301 https://git.shore.co.il/explore; } location /git { return 301 https://git.shore.co.il/explore; } location /git/ { return 301 https://git.shore.co.il/explore; } - - location /lam { - proxy_pass http://$lam$request_uri; - proxy_http_version 1.1; - include snippets/proxy-headers.conf; - include snippets/allow-private-ips.conf; - } - - location /jellyfin { return 302 $scheme://$host/jellyfin/; } - location /jellyfin/ { - proxy_pass http://$kodi:8096/jellyfin/; - proxy_http_version 1.1; - include snippets/proxy-headers.conf; - include snippets/common-headers.conf; - - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $http_connection; - - # Disable buffering when the nginx proxy gets very resource heavy upon streaming - proxy_buffering off; - } - - location /TRANSMISSION/ { - proxy_pass http://kodi.shore.co.il:9091/; - proxy_http_version 1.1; - include snippets/proxy-headers.conf; - } } diff --git a/docker-compose.yml b/docker-compose.yml index c1fa0099f19afb2427b68299041ec56f1f0745f8..e50d9f94908b2ded41082fc3382a943db8b62ffb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,11 +3,9 @@ version: '3.5' services: proxy: build: - args: - TRANSMISSION: "${TRANSMISSION}" context: ./ # command: ["nginx", "-g", "daemon off;"] - hostname: &hostname www.shore.co.il + hostname: &hostname "${HOSTNAME}" networks: default: aliases: