Automated solution for hosting email, web, DNS, XMPP, Git, and ZNC on OpenBSD.
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_proxy.yml 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. - name: enable nginx vhost
  2. copy:
  3. content: |
  4. server {
  5. listen 443 ssl http2;
  6. listen [::]:443 ssl http2;
  7. {% if bare | default(false) %}
  8. server_name {{ domain }};
  9. {% else %}
  10. server_name {{ vhost | default(name + "." + domain) }};
  11. {% endif %}
  12. client_max_body_size {{ max_body_size | default('5m') }};
  13. location / {
  14. {% if port is defined %}
  15. proxy_pass http://127.0.0.1:{{ port }};
  16. {% elif socket is defined %}
  17. proxy_pass http://unix:{{ socket }}:;
  18. {% endif %}
  19. proxy_set_header Host $server_name;
  20. proxy_set_header X-Forwarded-Host $host;
  21. proxy_set_header X-Forwarded-Port $server_port;
  22. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  23. proxy_set_header X-Real-IP $remote_addr;
  24. proxy_set_header X-Forwarded-Proto https;
  25. proxy_http_version 1.1;
  26. }
  27. {% if bare | default(false) %}
  28. location /.well-known {
  29. {% if port is defined %}
  30. proxy_pass http://127.0.0.1:{{ port }};
  31. {% elif socket is defined %}
  32. proxy_pass http://unix:{{ socket }}:;
  33. {% endif %}
  34. proxy_set_header Host $server_name;
  35. proxy_set_header X-Forwarded-Host $host;
  36. proxy_set_header X-Forwarded-Port $server_port;
  37. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  38. proxy_set_header X-Real-IP $remote_addr;
  39. proxy_set_header X-Forwarded-Proto https;
  40. proxy_http_version 1.1;
  41. add_header Access-Control-Allow-Origin *;
  42. }
  43. {% endif %}
  44. }
  45. dest: /etc/nginx/sites/{{ "bare" if (bare | default(false)) else name }}.conf
  46. notify: reload nginx