server {
    listen 80;
    listen 443 ssl;
    server_name ${SRS_DOMAIN};
    client_max_body_size 2g;
    ssl_certificate /etc/nginx/t-aaron.com.pem;
    ssl_certificate_key /etc/nginx/t-aaron.com.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header  X-Real-IP    $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://${SRS_NAME}:8080;
    }

    location /recording/ {
        alias /data/recording/;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
        charset utf-8;
        
        # 允许所有文件类型访问
        include mime.types;
        default_type application/octet-stream;
        
        # 添加一些基本的访问控制
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, HEAD';
        
        # 配置文件下载时的行为
        if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx|jpg|jpeg|png|gif|svg|mp3|mp4|wav|avi|mov|wmv|flv|mkv)$) {
            add_header Content-Disposition 'attachment';
        }
    }
}                                                                                                                                                                                                                                                 
