上传大文件时,Nginx代理超时

我遇到了Nginx的奇怪行为。 在我的例子中,Nginx作为Jetty的代理。 configuration如下:

server { listen 80; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m; client_max_body_size 5M; server_name test.com www.test.com location / { auth_basic "Restricted area"; auth_basic_user_file /etc/nginx/htpasswd; proxy_pass http://localhost:8080; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto http; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; gzip on; } } 

上传大小超过5M的文件时,我会收到'网关超时'。 CPU使用率为0%。 我不知道什么是错的。 这与networking速度无关,因为我正在本地进行testing。

如果我跳过一个代理,并尝试直接上传文件到应用服务器(我的意思是:在端口8080),一切都像一个魅力。

任何想法 ?? 问候!

可能你需要改变极限

  client_max_body_size 5M; 

类似的东西

  client_max_body_size 10M;