我要感谢 Jakub Siemaszko 的指点,这是部分解决方案。
我们的应用程序部署在一个 k8s 集群中,我们在其中一个 pod 中有一个 nginx 控制器和一个 nginx 实例。我遇到的问题与 pod 中的 nginx 而不是控制器有关(我正在更改控制器中的指令和键)
在 pod 内部的 nginx 中,我必须更改 nginx.conf 并将以下内容添加到 HTTP 和位置
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
client_max_body_size 25000M;
proxy_buffering off;
proxy_ignore_client_abort on;
proxy_read_timeout 3600;
proxy_http_version 1.1;
proxy_connect_timeout 3600;
proxy_send_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_read_timeout 3600;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
sendfile off;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
server {
listen 80 default_server;
server_name _;
root /usr/share/nginx/html;
index index.html;
location /api {
return 302 /api/;
}
location /api/ {
proxy_pass http://backend:3000/;
}
location /downloads {
autoindex on;
}
location / {
try_files $uri $uri/ /index.html;
proxy_read_timeout 3600;
proxy_http_version 1.1;
proxy_connect_timeout 3600;
proxy_send_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_read_timeout 3600;
}
}
include /etc/nginx/conf.d/*.conf;
}
这修复了 504 错误(我仍然看到 499,但它能够完成大文件的上传)。
至于临时文件的位置,这仍然是一个谜,但我们不再需要监控了