用nginx作代理服务器,上传文件时,提示 content-length 错误。
原因是nginx对上传文件的大小有限制,默认是1M。
同时,nginx 对上传超时时间也有限制,如果文件很大,需要做适当调整。
server {
listen 80;
server_name mohist-pc.test1.sc.cn mohist-pc.natapp2.touchealth.com;
charset utf-8;
client_max_body_size 75M; # adjust to taste
location / {
alias /app/jenkins/workspace1/mountains-web-mohist-pc199/dist/;
index index.html;
try_files $uri $uri/ /index.html;
proxy_set_header X-Real-IP $remote_addr;
}
}
将 client_max_body_size 改为 75M 后问题得到解决。