| {% for app in services -%} |
| upstream target_service { |
| {% for host in app['hosts'] -%} |
| server {{ host['hostname'] }}:{{ host['port'] }}; |
| {% endfor %} |
| } |
| {% endfor %} |
| |
| |
| server { |
| listen {{ port }} ssl http2; |
| server_name {{ server_name }}; |
| |
| access_log /var/log/nginx.access.log; |
| error_log /var/log/nginx.error.log; |
| |
| ssl on; |
| ssl_session_cache builtin:1000 shared:SSL:10m; |
| ssl_certificate {{ server_certificate }}; |
| ssl_certificate_key {{ server_key }}; |
| ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; |
| ssl_prefer_server_ciphers on; |
| |
| |
| location / { |
| proxy_buffering off; |
| proxy_set_header Host $host; |
| proxy_set_header X-Real-IP $remote_addr; |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| proxy_set_header X-Forwarded-Proto $scheme; |
| proxy_set_header X-Forwarded-Proto-Version $http2; |
| proxy_set_header Upgrade $http_upgrade; |
| proxy_set_header Connection $http_connection; |
| proxy_set_header X-Stream-Protocol-Version $http_x_stream_protocol_version; |
| |
| add_header X-Stream-Protocol-Version $upstream_http_x_stream_protocol_version; |
| |
| proxy_pass https://target_service; |
| proxy_read_timeout {{ proxy_read_timeout }}; |
| } |
| } |