diff options
author | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2019-04-17 19:32:05 +0200 |
---|---|---|
committer | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2019-04-17 19:32:05 +0200 |
commit | d2bddf17abafb85fcd6bccc078ccca46d7a72478 (patch) | |
tree | f247fed8833f9b5a4edf4d7c1613b550a3dbafb1 /templates/nginx.conf.j2 | |
parent | Change docker compose dir (diff) |
Move generate nginx file per domain
Diffstat (limited to 'templates/nginx.conf.j2')
-rw-r--r-- | templates/nginx.conf.j2 | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 new file mode 100644 index 0000000..69b8d36 --- /dev/null +++ b/templates/nginx.conf.j2 @@ -0,0 +1,32 @@ +{% if server.http_redirect is defined and server.http_redirect %} +server { + listen 80; + server_name {{ server.name }}; + return 301 https://$server_name$request_uri; +} +{% endif %} + +server { + {% if server.http_redirect is not defined or not server.http_redirect %} + listen 80; + {% endif %} + listen 443 ssl; + server_name {{ server.name }}; + + location / { + {% if server.dir is defined %} + root {{ server.dir }}; + index index.html; + {% endif %} + {% if server.proxy is defined %} + proxy_pass http://{{server.proxy.host|default("localhost")}}:{{server.proxy.port|default("80")}}; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_redirect off; + proxy_http_version 1.1; + {% endif %} + } + +} |