vhosts.j2 1.1 KB

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