update nginx-proxy

This commit is contained in:
aynic.os 2023-02-20 17:03:31 +01:00
parent 7c8da80cbb
commit 4cc840d392
4 changed files with 6 additions and 11 deletions

View File

@ -2,10 +2,10 @@ FROM pinidh/nginx-proxy:alpine
ARG DOCKER_BUILD_DIR
RUN sed -i 's/\(function _resolvers() {\)$/function _nginx_config() {\n\t\/app\/nginx-config.sh\n}\n\n\1/;s/\(\t_default_certificate\)$/\1\n\n\t_nginx_config/' /app/docker-entrypoint.sh \
&& sed -i 's|\(\treturn 503;\)$|\t{{ if (exists (printf "/etc/nginx/vhost.d/%s" (or $.Env.DEFAULT "default"))) }}\n\tinclude {{ printf "/etc/nginx/vhost.d/%s" (or $.Env.DEFAULT "default") }};\n\t {{ if (exists (printf "/etc/nginx/vhost.d/default_location")) }}\n{{ if $.Env.DEFAULT_LOCATION }}\tinclude {{ printf "/etc/nginx/vhost.d/default_location" }};{{ end }}\n\t {{ if (exists (printf "/etc/nginx/vhost.d/default_location_php")) }}\n{{ if $.Env.DEFAULT_LOCATION_PHP }}\tinclude {{ printf "/etc/nginx/vhost.d/default_location_php" }};{{ end }}\n\t {{ end }}\n\t {{ if (exists (printf "/etc/nginx/vhost.d/default_location_ipfs")) }}\n{{ if $.Env.DEFAULT_LOCATION_IPFS }}\tinclude {{ printf "/etc/nginx/vhost.d/default_location_ipfs" }};{{ end }}\n\t {{ end }}\n\t {{ end }}\n\t{{ else }}\n\1\n\t{{ end }}|' /app/nginx.tmpl \
&& sed -i 's|\({{ if (exists "/etc/nginx/proxy.conf") }}\)|{{ if (exists "/etc/nginx/vhost.d/nginx.conf") }}\ninclude /etc/nginx/vhost.d/nginx.conf;\n{{ end }}\n\n\1|' /app/nginx.tmpl \
&& sed -i 's|exists "/etc/nginx/vhost.d/default"|exists (printf "/etc/nginx/vhost.d/%s" (or $.Env.DEFAULT "default"))|;s|include /etc/nginx/vhost.d/default;|include {{ printf "/etc/nginx/vhost.d/%s" (or $.Env.DEFAULT "default") }};|' /app/nginx.tmpl \
&& sed -i 's|\(include /etc/nginx/vhost.d/default_location;\)|\1\n\t\t{{ if (exists (printf "/etc/nginx/vhost.d/default_location_php")) }}\n{{ if $.Env.DEFAULT_LOCATION_PHP }}\tinclude {{ printf "/etc/nginx/vhost.d/default_location_php" }};{{ end }}\n\t\t{{ end }}\n\t\t{{ if (exists (printf "/etc/nginx/vhost.d/default_location_ipfs")) }}\n{{ if $.Env.DEFAULT_LOCATION_IPFS }}\tinclude {{ printf "/etc/nginx/vhost.d/default_location_ipfs" }};{{ end }}\n\t\t{{ end }}|' /app/nginx.tmpl \
&& sed -i 's|\(include /etc/nginx/vhost.d/default_location;\)|\1\n {{- end }}\n {{- if (and (exists "/etc/nginx/vhost.d/default_location_php") ($.Env.DEFAULT_LOCATION_PHP)) }}\n include /etc/nginx/vhost.d/default_location_php;\n {{- end }}\n {{- if (and (exists "/etc/nginx/vhost.d/default_location_ipfs") ($.Env.DEFAULT_LOCATION_IPFS)) }}\n include /etc/nginx/vhost.d/default_location_ipfs;|' /app/nginx.tmpl \
&& sed -i 's|\( return 503;\)$|{{- if (exists (printf "/etc/nginx/vhost.d/%s" (or $.Env.DEFAULT "default"))) }}\n include {{ (printf "/etc/nginx/vhost.d/%s" (or $.Env.DEFAULT "default")) }};\n{{- if (and (exists "/etc/nginx/vhost.d/default_location") ($.Env.DEFAULT_LOCATION)) }}\n include /etc/nginx/vhost.d/default_location;\n{{- end }}\n{{- if (and (exists "/etc/nginx/vhost.d/default_location_php") ($.Env.DEFAULT_LOCATION_PHP)) }}\n include /etc/nginx/vhost.d/default_location_php;\n{{- end }}\n{{- if (and (exists "/etc/nginx/vhost.d/default_location_ipfs") ($.Env.DEFAULT_LOCATION_IPFS)) }}\n include /etc/nginx/vhost.d/default_location_ipfs;\n{{- end }}\n{{- else }}\n\1\n{{- end }}|' /app/nginx.tmpl \
&& sed -i 's|\({{-\? if (exists "/etc/nginx/proxy.conf") }}\)|{{- if (exists "/etc/nginx/vhost.d/nginx.conf") }}\ninclude /etc/nginx/vhost.d/nginx.conf;\n{{ end }}\n\n\1|' /app/nginx.tmpl \
&& sed -i 's|exists "/etc/nginx/vhost.d/default"|exists (printf "/etc/nginx/vhost.d/%s" (or $.Env.DEFAULT "default"))|;s|include /etc/nginx/vhost.d/default;|include {{ (printf "/etc/nginx/vhost.d/%s" (or $.Env.DEFAULT "default")) }};|' /app/nginx.tmpl \
&& awk '/proxy_pass \{\{ trim .Proto \}\}/{sub(/else/, "else if ne .Proto \"local\"", last)} NR>1{print last} {last=$0} END {print last}' /app/nginx.tmpl > /tmp/nginx.tmpl && mv /tmp/nginx.tmpl /app/
COPY ${DOCKER_BUILD_DIR}/nginx* /app

View File

@ -4,7 +4,7 @@ set -eu
##
# CONFIG
sed -i 's/fastcgi_param * SERVER_SOFTWARE *.*/fastcgi_param SERVER_SOFTWARE nginx;/' /etc/nginx/fastcgi_params
sed -i 's/fastcgi_param * SERVER_SOFTWARE *.*/fastcgi_param SERVER_SOFTWARE nstix;/' /etc/nginx/fastcgi_params
##
# DEFAULT

View File

@ -15,7 +15,7 @@ services:
- DEFAULT_LOCATION_PHP=${HOST_NGINX_DEFAULT_LOCATION_PHP:-}
- DEFAULT_LOCATION_IPFS=${HOST_NGINX_DEFAULT_LOCATION_IPFS:-}
- LETSENCRYPT_HOST=${HOST_NGINX_LETSENCRYPT_HOST:-${HOST_NGINX_VIRTUAL_HOST:-}}
- LETSENCRYPT_EMAIL=${HOST_NGINX_LETSENCRYPT_EMAIL:-${DEFAULT_EMAIL:-${MAIL:-nginx@localhost}}}
- LETSENCRYPT_EMAIL=${HOST_NGINX_LETSENCRYPT_EMAIL:-${HOST_ACME_DEFAULT_EMAIL:-${DEFAULT_EMAIL:-${MAIL:-nginx@localhost}}}}
- LETSENCRYPT_SINGLE_DOMAIN_CERTS=${HOST_NGINX_LETSENCRYPT_SINGLE_DOMAIN_CERTS:-true}
- LETSENCRYPT_TEST=${HOST_NGINX_LETSENCRYPT_TEST:-${LETSENCRYPT_TEST:-}}
- SSL_POLICY=${HOST_NGINX_SSL_POLICY:-Mozilla-Modern}

View File

@ -1,11 +1,6 @@
version: '3.6'
services:
apache-php5:
environment:
- DOCUMENT_ROOT=/dns
volumes:
- dns:/dns
nginx:
environment:
- DEFAULT=default_dns