vhosts.j2 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {% for x509 in vhosts_x509.results %}
  2. {%- set vhost = x509.vhost -%}
  3. server {
  4. {% if vhost.ssl is defined and vhost.ssl %}
  5. listen {{ vhost.listen | default('443') }} ssl;
  6. ssl_certificate "{{ x509.cert_path }}";
  7. ssl_certificate_key "{{ x509.key_path }}";
  8. {% else %}
  9. listen {{ vhost.listen | default('80 default_server') }};
  10. {% endif %}
  11. {% if vhost.server_name is defined %}
  12. server_name {{ vhost.server_name }};
  13. {% endif %}
  14. {% if vhost.root is defined %}
  15. root {{ vhost.root }};
  16. {% endif %}
  17. index {{ vhost.index | default('index.html index.htm') }};
  18. {% if vhost.error_page is defined %}
  19. error_page {{ vhost.error_page }};
  20. {% endif %}
  21. {% if vhost.access_log is defined %}
  22. access_log {{ vhost.access_log }};
  23. {% endif %}
  24. {% if vhost.error_log is defined %}
  25. error_log {{ vhost.error_log }} error;
  26. {% endif %}
  27. {% if vhost.return is defined %}
  28. return {{ vhost.return }};
  29. {% endif %}
  30. {% if vhost.extra_parameters is defined %}
  31. {{ vhost.extra_parameters|indent(4) }}
  32. {% endif %}
  33. }
  34. {% endfor %}