Bladeren bron

configure default server

pull/342/head
Guillaume Vincent 8 jaren geleden
bovenliggende
commit
03381a8415
4 gewijzigde bestanden met toevoegingen van 7 en 9 verwijderingen
  1. +0
    -1
      Dockerfile
  2. +4
    -1
      backend.conf.j2
  3. +0
    -4
      conf.d/default.conf
  4. +3
    -3
      install.py

+ 0
- 1
Dockerfile Bestand weergeven

@@ -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


+ 4
- 1
backend.conf.j2 Bestand weergeven

@@ -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;
}
}

+ 0
- 4
conf.d/default.conf Bestand weergeven

@@ -1,4 +0,0 @@
server {
listen 80 default_server;
return 444;
}

+ 3
- 3
install.py Bestand weergeven

@@ -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')

Laden…
Annuleren
Opslaan