我在DigitalOcean上存储了一个Rails应用程序。在大文件上传期间(~70Mb),我的Nginx不时失败(比如一次在3中)。我也有后台导入进程运行(但我不确定它是否与问题有关)。
我收到502错误,在日志中我看到upstream permanently closed connection while reading response header from upstream
。
我的nginx.conf
看起来与此相似:
upstream backend {
server unix://var/www/my_app/shared/tmp/sockets/puma.sock;
}
server {
listen 80;
root /var/www/my_app/current/public;
client_max_body_size 600m;
proxy_connect_timeout 1200s;
proxy_send_timeout 1200s;
proxy_read_timeout 1200s;
client_header_timeout 1200s;
client_body_timeout 1200s;
client_header_buffer_size 1024k;
client_body_buffer_size 600m;
send_timeout 1200s;
keepalive_timeout 1200s;
large_client_header_buffers 8 1024k;
fastcgi_read_timeout 1200s;
error_log /var/www/my_app/current/log/nginx.error.log info;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 1200s;
types_hash_max_size 2048k;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
有人可以建议Nginx一直失败的原因是什么,以及如何修复它?