Writes configuration files for nginx based on running services and certificates
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nginx.tpl 815B

12345678910111213141516171819202122232425
  1. {% for srvname, service in services.items() %}
  2. upstream {{ service.upstream }} {
  3. {% for upstream in service.hosts %}
  4. server {{ upstream.host }}:{{ upstream.port }};
  5. {% endfor %}
  6. }
  7. server {
  8. server_name {{ ' '.join(service.vhosts) }};
  9. listen [::]:443{{ ' default_server' if service.default }} ssl http2;
  10. listen 443{{ ' default_server' if service.default }} ssl http2;
  11. ssl_certificate {{ service.certificate }};
  12. ssl_trusted_certificate {{ service.trusted_certificate }};
  13. ssl_certificate_key {{ service.certificate_key }};
  14. include /etc/nginx/conf.d/{{ service.vhosts[0] }}/*.conf;
  15. location / {
  16. proxy_pass {{ service.protocol }}://{{ service.upstream }};
  17. proxy_set_header Host $host;
  18. proxy_set_header X-Forwarded-For $remote_addr;
  19. }
  20. }
  21. {% endfor %}