您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

vhost.conf.j2 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. }