配置Nginx的nginx.conf文件,内网OSS转发到外网,实现外网访问内网的oss资源

upstream ossproxy {
        # 对应的阿里内网访问的节点域名Endpoint
    server oss-cn-hangzhou-internal.aliyuncs.com; # 这里替换
}
server
{
    listen 80;
    server_name image.katejk.com;
    error_page 404 http://xxx.com/404.html;
    error_page 502 http://xxx.com/502.html;
    
    location /nginx_status {
        stub_status on;
        access_log off;
        allow 127.0.0.1;
        deny all;
    }
    
     location ~ {
        proxy_pass http://ossproxy;
        proxy_redirect     off;
        # 一般情况下就是 bucket域名
        proxy_set_header   Host   wzkate.oss-cn-hangzhou-internal.aliyuncs.com;  #这里替换
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_max_temp_file_size 0;
        proxy_connect_timeout      90;
        proxy_send_timeout         90;
        proxy_read_timeout         90;
        proxy_buffer_size          4k;
        proxy_buffers              4 32k;
        proxy_busy_buffers_size    64k;
        proxy_temp_file_write_size 64k;
    }
}

你可能感兴趣的:(配置Nginx的nginx.conf文件,内网OSS转发到外网,实现外网访问内网的oss资源)