Playbooks to a new Lilik
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.

25 lines
856 B

  1. {% for server_name in [reverse_proxy_site_fqdn] | flatten(levels=1) %}
  2. server {
  3. listen {{ public_ip }}:80;
  4. server_name
  5. {{ server_name }}{% if reverse_proxy_www_redir %} www.{{ server_name }}{% endif %};
  6. # Redirect ACME Challenges to the upstream server port 80
  7. location /.well-known/acme-challenge/ {
  8. proxy_set_header X-Real-IP $remote_addr;
  9. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  10. proxy_set_header Host $host;
  11. proxy_set_header X-NginX-Proxy true;
  12. proxy_pass http://{{ hostvars | ip_from_inventory(ansible_hostname) }};
  13. }
  14. # Redirect to HTTPS all non-ACME requests
  15. location / {
  16. if ($request_method = POST) {
  17. return 307 https://$server_name$request_uri;
  18. }
  19. return 301 https://$server_name$request_uri;
  20. }
  21. }
  22. {% endfor %}