server {
    listen 80 default_server;
    server_name _;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /var/www/html;
        index  index.html index.htm;
        try_files $uri $uri/ //index.html;
    }

    # 启用访问日志，并指定日志文件路径和格式
    access_log /var/log/nginx/host.access.log;

    # 打印错误日志文件信息
    error_log /var/log/nginx/host.error.log;
    location /yllog  {
        root /var/log/nginx;
        autoindex on;
    }

    location /aiagent/ {
        proxy_pass https://yiligpt.x.digitalyili.com;
        proxy_set_header Host yiligpt.x.digitalyili.com;
        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;
    }

    # 定义日志格式（通常在 http 块中定义即可）
    # log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /var/www/html;
    }

}
