nginx配置反向代理,文件上传模块

时间:2022-10-20 06:06:48

upstream tornado{
server 127.0.0.1:8000;
}
server {
listen 80;
server_name render.infra.lzyco.com;
location /upload {
upload_pass /uploadFile;
upload_store /tmp/tornado;
# upload_limit_rate 1024k;
upload_set_form_field "${upload_field_name}_name" $upload_file_name;
upload_set_form_field "${upload_field_name}_content_type" $upload_content_type;
upload_set_form_field "${upload_field_name}_path" $upload_tmp_path;
upload_aggregate_form_field "${upload_field_name}_md5" $upload_file_md5;
upload_aggregate_form_field "${upload_field_name}_size" $upload_file_size;
upload_pass_form_field "^submit$|^description$";

client_max_body_size 1000m;

}

location /uploadFile {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X_Real_IP $remote_addr;
proxy_set_header X-Scheme $scheme;

proxy_pass http://tornado;
}

location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X_Real_IP $remote_addr;
proxy_set_header X-Scheme $scheme;

proxy_pass http://tornado;
client_max_body_size 1000m;
}

}