upstream csfzx_app_backend {
    least_conn;

    server 192.211.45.168:80 max_fails=3 fail_timeout=10s;
    server 192.211.45.169:80 max_fails=3 fail_timeout=10s;

    keepalive 32;
}

server {
    listen 443 ssl http2;
    server_name csfzx.yyangpt.cn;

    ssl_certificate /usr/local/nginx/conf/ssl/yyangpt.cn/fullchain.crt;
    ssl_certificate_key /usr/local/nginx/conf/ssl/yyangpt.cn/privkey.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:CSFZX_SSL:20m;
    ssl_session_timeout 10m;

    client_max_body_size 50m;

    add_header Strict-Transport-Security "max-age=31536000" always;
    add_header X-Content-Type-Options nosniff always;
    add_header X-XSS-Protection "1; mode=block" always;
    add_header Content-Security-Policy "manifest-src 'self'" always;

    location = /lb-health {
        access_log off;
        default_type text/plain;
        return 200 "ok\n";
    }

    location / {
        proxy_pass http://csfzx_app_backend;
        proxy_http_version 1.1;
        proxy_set_header Connection "";

        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-Port 443;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_connect_timeout 10s;
        proxy_send_timeout 300s;
        proxy_read_timeout 300s;

        proxy_next_upstream error timeout invalid_header http_502 http_503 http_504;
        proxy_next_upstream_tries 2;
    }

    access_log /workspace/wwwlogs/csfzx.yyangpt.cn.ssl.log main;
    error_log /workspace/wwwlogs/csfzx.yyangpt.cn.ssl.error.log warn;
}
