我正在使用fileuploadfield组件将文件从浏览器上传到NGINX服务器。文件大小为3Gb。 NGINX版本是1.12.0。我有以下NGINX配置:
http {
server {
listen 443;
server_name SERVER_NAME_OR_IP;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug;
ssl on;
ssl_certificate /path/to/cert.crt;
ssl_certificate_key /path/to/cert.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
location ~* /test/abcd/ {
client_max_body_size 3075m;
proxy_pass http://127.0.0.1:7000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_address;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 127.0.0.1:7000;
server_name SERVER_NAME_OR_IP;
client_max_body_size 3075m;
location / {
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PHP_VALUE "upload_max_filesize = 3075M \n
post_max_size=3075M";
include /etc/nginx/fastcgi_params;
}
}
}
问题是有时(它不会100%重现),当我上传3Gb文件时,nginx服务器部分写入/ tmp /中的文件(它不会写入具有3Gb大小的文件,每次它是一个不同的大小)。过了一会儿,在浏览器中我收到错误:504网关超时,在PHP中:上传失败,错误3。 你知道可能是什么问题吗?
谢谢!