diff --git a/Dockerfile b/Dockerfile index 49387ea..2963f99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,6 @@ COPY conf.d/nginx.conf /etc/nginx/nginx.conf COPY conf.d/mime.types /etc/nginx/mime.types RUN rm /etc/nginx/conf.d/default.conf -COPY conf.d/default.conf /etc/nginx/conf.d/default.conf RUN mkdir /dockersible COPY dockersible/ /dockersible diff --git a/backend.conf.j2 b/backend.conf.j2 index f91a633..de3d4ba 100644 --- a/backend.conf.j2 +++ b/backend.conf.j2 @@ -1,5 +1,6 @@ server { - listen 80; + listen 80 default_server; + listen [::]:80 default_server; {% if domain %} server_name {{ domain }} www.{{ domain }}; {% else %} @@ -54,6 +55,7 @@ server { proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Url-Scheme $scheme; proxy_redirect off; } @@ -63,6 +65,7 @@ server { proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Url-Scheme $scheme; proxy_redirect off; } } diff --git a/conf.d/default.conf b/conf.d/default.conf deleted file mode 100644 index 9b8f8ab..0000000 --- a/conf.d/default.conf +++ /dev/null @@ -1,4 +0,0 @@ -server { - listen 80 default_server; - return 444; -} diff --git a/install.py b/install.py index 7b254c5..c5aca90 100644 --- a/install.py +++ b/install.py @@ -6,7 +6,7 @@ from dockersible.files import copy, template def get_ssl_context(environ): - domain = environ['domain'] + domain = environ['DOMAIN'] nginx_info = { 'domain': domain, 'dhparam': False, @@ -44,8 +44,8 @@ def get_certificates(domain): if __name__ == "__main__": - pk, crt = get_certificates(os.environ['domain']) + pk, crt = get_certificates(os.environ['DOMAIN']) copy(source=pk, destination='/etc/ssl/private', basename='private.key', mode='0600') copy(source=crt, destination='/etc/ssl/certs', basename='certificate.crt', mode='0644') - template('/backend.conf.j2', get_ssl_context(os.environ), '/etc/nginx/conf.d/backend.conf') + template('/backend.conf.j2', get_ssl_context(os.environ), '/etc/nginx/conf.d/default.conf')