上传大文件关键分析

2021/03/30 posted in  服务端
Tags:  #nginx #php

php写了个upload,在大文件的时候经常失败,某些项目还是nginx+fpm的通讯
排查之后,几个关键点配置

nginx相关

与php fpm相关

fastcgi_connect_timeout 6000;
fastcgi_send_timeout 6000;
fastcgi_read_timeout 6000;
fastcgi_buffer_size 256k;
fastcgi_buffers 8 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;

非fpm相关

proxy_connect_timeout         60s;
proxy_read_timeout            1m;
proxy_send_timeout            1m;

客户端与nginx连通

keepalive_timeout  100;
client_max_body_size    1000m;
client_header_timeout         1m;
client_body_timeout           1m;

php相关

配置

cat  >  docker-php-ext-php.ini  <<hh
upload_max_filesize = 1000M
post_max_size=1000M
hh

cat写入方法方式
cat向文件中写入内容
写入:
cat > test.txt < hello world
hh
追加:
cat >> test.txt <<hh
hello world
hh

参考链接

https://blog.csdn.net/joeyon1985/article/details/50036095
https://www.cnblogs.com/kevingrace/p/6093671.html