小编tom*_*kup的帖子

上传大文件时 Nginx 代理超时

我在使用 Nginx 时遇到了奇怪的行为。就我而言,Nginx 充当 Jetty 的代理。配置如下:

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;
    }
}
Run Code Online (Sandbox Code Playgroud)

上传大小大于 5M 的文件时,出现“网关超时”。CPU 使用率为 0%。我不知道出了什么问题。它与网络速度无关,因为我正在本地测试。

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

任何的想法 ??问候!

nginx timeout upload

4
推荐指数
2
解决办法
2万
查看次数

标签 统计

nginx ×1

timeout ×1

upload ×1