Nginx uploads large files

The file transfer

Nginx upload file size limit client_max_body_size 1024M;Set the size of the uploaded file
sendfile on;         # Set to on to enable efficient transmission mode
keepalive_timeout 1800;         Hold the connection time

Copy the code

Nginx efficient file transfer

sendfile on;   Enable efficient transport mode

tcp_nopush on;      Send the entire response header in a TCP packet

tcp-nodelay on;
Copy the code

Network timeout

client_header_timeout 60s;      The client and server receive the HTTP header after the connection.

client_body_timeout 60s;        Read the HTTP body timeout

send_timeout 60s;       Send response timeout

keepalive_timeout 75s;          The server will be disconnected from the browser after the keepalive connection expires.

keepalive_requests 100;         A keepalive connection can send up to 100 requests by default

lingering_close on/off/always;      Always indicates that all data sent by users on the connection must be processed unconditionally before closing the user connection. Off: Closes the connection regardless of whether there is ready data from the user on the connection. On is the median value, and data sent by the user on the connection is generally processed before the connection is closed, except in some cases after which data is deemed unnecessary for business purposes.

lingering_time 30s;         The default time is 30s.

Copy the code