reverse_proxy.conf.j2 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. server {
  2. listen 80;
  3. listen [::]:80;
  4. listen 443 ssl http2;
  5. server_name {{item.server_name}};
  6. keepalive_timeout 200;
  7. {{item.custom_config | default('') | indent(2)}}
  8. {% if with_ssl %}
  9. ssl_session_timeout 5m;
  10. ssl_session_cache shared:SSL:50m;
  11. ssl_session_tickets off;
  12. ssl_certificate /etc/nginx/certs/ada/ada.crt;
  13. ssl_certificate_key /etc/nginx/certs/ada/ada.key;
  14. {% endif %}
  15. location / {
  16. proxy_pass {{item.proxy_pass}};
  17. # set host
  18. proxy_set_header Host $host;
  19. proxy_set_header X-Forwarded-For 42.42.42.42;
  20. proxy_set_header X-Forwarded-Proto $scheme;
  21. proxy_set_header X-Forwarded-Host $host;
  22. proxy_set_header X-Forwarded-Port $server_port;
  23. # websocket proxy
  24. proxy_http_version 1.1;
  25. proxy_set_header Upgrade $http_upgrade;
  26. proxy_set_header Connection "upgrade";
  27. # compression
  28. gzip on;
  29. gzip_types text/plain application/xml application/json;
  30. gzip_proxied no-cache no-store private expired auth;
  31. gzip_min_length 1000;
  32. # cache
  33. proxy_cache STATIC;
  34. }
  35. }