Nginx反向代理Onedrive的配置

配置如下,域名及证书部分需自行替换。

server
{
    listen 80;
    listen 443 ssl http2;
    server_name yourdomain.com;
    
    ssl_certificate /usr/local/nginx/conf/ssl/yourdomain.com/fullchain.cer;
    ssl_certificate_key /usr/local/nginx/conf/ssl/yourdomain.com/yourdomain.com.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    
    location  ~* \.(php|jsp|cgi|asp|aspx)$
    {
        proxy_pass https://your-od-domain.com; 
        proxy_set_header Host your-od-domain.com; #此处没有https
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header Range $http_range;
    }
    
    location /
    {
        proxy_pass https://your-od-domain.com;
        proxy_set_header Host your-od-domain; #此处没有https
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header Range $http_range;
        
        add_header X-Cache  $upstream_cache_status;
        add_header Cache-Control  no-cache;
        expires 12h;
    }
}

Visits: 88

留下评论

您的电子邮箱地址不会被公开。 必填项已用*标注