# Managed by Ansible (nginx-proxy role) - vhost: {{ vhost_name }} server { listen 80; server_name {{ vhost_domain }}; return 301 https://{{ vhost_domain }}$request_uri; } server { listen 443 ssl; {% if nginx_proxy_http2 | bool %} http2 on; {% endif %} server_name {{ vhost_domain }}; ssl_certificate /etc/nginx/certs/live/{{ vhost_domain }}/fullchain.pem; ssl_certificate_key /etc/nginx/certs/live/{{ vhost_domain }}/privkey.pem; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-XSS-Protection "1; mode=block" always; location / { proxy_pass http://{{ vhost_upstream_host | default('127.0.0.1') }}:{{ vhost_upstream_port }}; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port $server_port; # WebSocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_connect_timeout 60s; proxy_send_timeout {{ vhost_proxy_timeout | default('60s') }}; proxy_read_timeout {{ vhost_proxy_timeout | default('60s') }}; proxy_buffering off; proxy_request_buffering off; } {% if vhost_health_path | default('') | length > 0 %} location {{ vhost_health_path }} { proxy_pass http://{{ vhost_upstream_host | default('127.0.0.1') }}:{{ vhost_upstream_port }}{{ vhost_health_path }}; access_log off; } {% endif %} }