Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

61 lines
1.4KB

  1. server {
  2. server_name {{ vhost.server_names | join(' ') }};
  3. listen 443 ssl;
  4. listen [::]:443 ssl;
  5. ssl_certificate /etc/ssl/certs/{{ certificate_name | default(vhost.certificate_name) | default(vhost.name) }}.fullchain.pem;
  6. ssl_certificate_key /etc/ssl/private/{{ certificate_name | default(vhost.certificate_name) | default(vhost.name) }}.key.pem;
  7. add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; ";
  8. charset utf-8;
  9. {% if vhost.try_files is defined %}
  10. try_files {{ vhost.try_files }};
  11. {% endif %}
  12. {% if vhost.locations is defined %}
  13. {% for loc in vhost.locations %}
  14. location {{ loc.location }} {
  15. {% if loc.proxy_pass is defined %}
  16. proxy_pass {{ loc.proxy_pass }};
  17. proxy_set_header Host $http_host;
  18. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  19. {% endif %}
  20. {% if loc.alias is defined %}
  21. alias {{ loc.alias }};
  22. {% endif %}
  23. {% if loc.try_files is defined %}
  24. try_files {{ loc.try_files }};
  25. {% endif %}
  26. {% if loc.redirect is defined %}
  27. return 301 {{ loc.redirect }};
  28. {% endif %}
  29. }
  30. {% endfor %}
  31. {% endif %}
  32. {% if vhost.root is defined %}
  33. root {{ vhost.root }};
  34. {% endif %}
  35. }
  36. server {
  37. listen 80;
  38. listen [::]:80;
  39. server_name {{ vhost.server_names | join(' ') }};
  40. location /.well-known/acme-challenge {
  41. default_type "text/plain";
  42. root /var/www/default;
  43. }
  44. return 301 https://$host$request_uri;
  45. }