Created
December 11, 2018 12:55
-
-
Save iamrommel/4236cb7796defc40aeb2c2a9edcc05bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
if (s.forceSsl) { | |
%> | |
server { | |
listen 80; | |
server_name <%-s.publicDomain%>; | |
# Used by Let's Encrypt | |
location /.well-known/ { | |
root <%-s.staticWebRoot%>; | |
} | |
location / { | |
return 302 https://$http_host$request_uri$is_args$query_string; | |
} | |
} | |
<% | |
} | |
%> | |
<% | |
if (!s.forceSsl || s.hasSsl) { | |
%> | |
server { | |
<% | |
if (!s.forceSsl) { | |
%> | |
listen 80; | |
<% | |
} | |
if (s.hasSsl) { | |
%> | |
listen 443 ssl; | |
ssl_certificate <%-s.crtPath%>; | |
ssl_certificate_key <%-s.keyPath%>; | |
<% | |
} | |
%> | |
client_max_body_size 500m; | |
server_name <%-s.publicDomain%>; | |
# 127.0.0.11 is DNS set up by Docker, see: | |
# https://docs.docker.com/engine/userguide/networking/configure-dns/ | |
# https://github.com/moby/moby/issues/20026 | |
resolver 127.0.0.11 valid=10s; | |
set $upstream http://<%-s.localDomain%>:5984; | |
location / { | |
proxy_pass $upstream; | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
location ~ ^/(.*)/_changes { | |
proxy_pass $upstream; | |
proxy_redirect off; | |
proxy_buffering off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
location /.well-known/ { | |
root <%-s.staticWebRoot%>; | |
} | |
} | |
<% | |
} | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment