I have a simple PHP file upload script that uploads a file. The server consists of 1 nginx reverse proxy and another nginx server (upstream). The problem is that when I try to upload very large files ~ 2GB then I get an error:
"504 Gateway Time-out"
Here is my reverse proxy configuration:
----------------------------------
server {
listen 80;
server_name upload.mycloudhost.com;
proxy_buffer_size 1024k;
proxy_buffers 4 1024k;
proxy_busy_buffers_size 1024k;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
client_body_timeout 600;
client_header_timeout 600;
keepalive_timeout 600;
uwsgi_read_timeout 600;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://localhost:13670;
}
}
----------------------------------
And here is the other nginx server (upstream):
----------------------------------
server {
listen 80;
server_name upload.mycloudhost.com;
client_max_body_size 80G;
proxy_buffer_size 1024k;
proxy_buffers 4 1024k;
proxy_busy_buffers_size 1024k;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
client_body_timeout 600;
client_header_timeout 600;
keepalive_timeout 600;
uwsgi_read_timeout 600;
root /var/www/mycloudhost;
index index.php index.html index.htm index.nginx-debian.html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri $uri/ =404;
}
}
----------------------------------
"504 Gateway Time-out"
Here is my reverse proxy configuration:
----------------------------------
server {
listen 80;
server_name upload.mycloudhost.com;
proxy_buffer_size 1024k;
proxy_buffers 4 1024k;
proxy_busy_buffers_size 1024k;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
client_body_timeout 600;
client_header_timeout 600;
keepalive_timeout 600;
uwsgi_read_timeout 600;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://localhost:13670;
}
}
----------------------------------
And here is the other nginx server (upstream):
----------------------------------
server {
listen 80;
server_name upload.mycloudhost.com;
client_max_body_size 80G;
proxy_buffer_size 1024k;
proxy_buffers 4 1024k;
proxy_busy_buffers_size 1024k;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
client_body_timeout 600;
client_header_timeout 600;
keepalive_timeout 600;
uwsgi_read_timeout 600;
root /var/www/mycloudhost;
index index.php index.html index.htm index.nginx-debian.html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri $uri/ =404;
}
}
----------------------------------