server {
    listen 443 ssl http2;
    server_name ai-dailyreport.cloud-top.com.cn;

    ssl_certificate /data/news/ssl/cloud-top.com.cn.pem;
    ssl_certificate_key /data/news/ssl/cloud-top.com.cn.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;

    if ($arg_l = ko) {
        rewrite ^/html/daily-report/$ /html/daily-report/ko-index.html?d=$arg_d? redirect;
    }

    location /save {
        proxy_pass http://127.0.0.1:8080;
        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;
    }

    location /html/daily-report/ {
        alias /data/news/html/daily-report/;
        autoindex on;
        add_header Access-Control-Allow-Origin *;
    }

    location = /html/daily-report/ko-index.html {
        alias /data/news/html/daily-report/ko-index.html;
        add_header Access-Control-Allow-Origin *;
    }

    location /html/test-report {
        alias /data/news/html/test-report;
        index index.html;
        add_header Access-Control-Allow-Origin *;
    }

    location /css/ { root /data/news; autoindex on; }
    location /images/ { root /data/news; autoindex on; }
    location /js/ { root /data/news; autoindex on; }
    location /webfonts/ { root /data/news; }
    location /json/ { root /data/news; autoindex on; add_header Access-Control-Allow-Origin *; add_header Cache-Control "no-cache"; }
    location /favicon.ico { root /data/news; }

    location / {
        return 403;
    }
}

server {
    listen 80;
    server_name ai-dailyreport.cloud-top.com.cn;
    return 301 https://$host$request_uri;
}
