N
N
neonox2013-11-03 18:00:51
PHP
neonox, 2013-11-03 18:00:51

Problem uploading files to the server

Given:

1. VPS server

2. PHP settings
- max_execution_time = 600
- max_input_time = 600
- memory_limit = 256M
- post_max_size = 100M
- upload_max_filesize = 100M
- max_file_uploads = 40

3. Nngix settings
- client_max_body_size 100M in ngnix settings

When uploading any files ( minimum size - 354 KB) the following happens to the server:
they are loaded up to about 30%, after that the download state is reset to 0%, the file is downloaded again at about 30% and the browser (Chrome) gives the following error: Error 101 (net::ERR_CONNECTION_RESET) : Connection dropped.

The situation is similar in other browsers.

Answer the question

In order to leave comments, you need to log in

8 answer(s)
S
stan_jeremy, 2013-11-03
@stan_jeremy

Can you post your nginx config? The error is not pkhpshnaya.

N
neonox, 2013-11-03
@neonox

Hidden text
user www-data;worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable «msie6»;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
include /usr/local/ispmgr/etc/nginx.domain;
log_format isp '$bytes_sent $request_length';
server {
server_name imanit.ru www.imanit.ru;
listen 146.185.163.91;
disable_symlinks if_not_owner from=$root_path;
set $root_path /var/www/imanit_msk/data/www/imanit.ru;
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
root $root_path;
access_log /var/www/nginx-logs/imanit_msk isp;
access_log /var/www/httpd-logs/imanit.ru.access.log;
error_page 404 = @fallback;
}
location / {
proxy_pass 146.185.163.91:81;
proxy_redirect 146.185.163.91:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100m;
client_body_buffer_size 256k;
}
location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
proxy_pass 146.185.163.91:81;
proxy_redirect 146.185.163.91:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location @fallback {
proxy_pass 146.185.163.91:81;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ^~ /webstat/ {
auth_basic «Restricted area»;
auth_basic_user_file /var/www/imanit_msk/data/etc/1969260.passwd;
try_files $uri @fallback;
}
include /usr/local/ispmgr/etc/nginx.inc;
}
server {
server_name i-manit.ru www.i-manit.ru;
listen 146.185.163.91;
disable_symlinks if_not_owner from=$root_path;
set $root_path /var/www/imanit_tver/data/www/i-manit.ru;
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
root $root_path;
access_log /var/www/nginx-logs/imanit_tver isp;
access_log /var/www/httpd-logs/i-manit.ru.access.log;
error_page 404 = @fallback;
client_max_body_size 100M;
client_body_buffer_size 256k;
}
location / {
proxy_pass 146.185.163.91:81;
proxy_redirect 146.185.163.91:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
proxy_pass 146.185.163.91:81;
proxy_redirect 146.185.163.91:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location @fallback {
proxy_pass 146.185.163.91:81;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ^~ /webstat/ {
auth_basic «Restricted area»;
auth_basic_user_file /var/www/imanit_tver/data/etc/1969352.passwd;
try_files $uri @fallback;
}
include /usr/local/ispmgr/etc/nginx.inc;
}
}
#mail {
# # See sample authentication script at:
# # wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities «TOP» «USER»;
# # imap_capabilities «IMAP4rev1» «UIDPLUS»;
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}

N
neonox, 2013-11-03
@neonox

Thanks for the instruction)))
Alas, but the error continues to go, when I download a file of 2.5 MB, I see a native window. There is nothing in the ngnix logs related to my problem
Now the config looks like this

Hidden text
user www-data;worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable «msie6»;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
include /usr/local/ispmgr/etc/nginx.domain;
log_format isp '$bytes_sent $request_length';
server {
server_name imanit.ru www.imanit.ru;
listen 146.185.163.91;
disable_symlinks if_not_owner from=$root_path;
set $root_path /var/www/imanit_msk/data/www/imanit.ru;
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
root $root_path;
access_log /var/www/nginx-logs/imanit_msk isp;
access_log /var/www/httpd-logs/imanit.ru.access.log;
error_page 404 = @fallback;
client_max_body_size 100m;
}
location / {
proxy_pass 146.185.163.91:81;
proxy_redirect 146.185.163.91:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
proxy_pass 146.185.163.91:81;
proxy_redirect 146.185.163.91:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location @fallback {
proxy_pass 146.185.163.91:81;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ^~ /webstat/ {
auth_basic «Restricted area»;
auth_basic_user_file /var/www/imanit_msk/data/etc/1969260.passwd;
try_files $uri @fallback;
}
include /usr/local/ispmgr/etc/nginx.inc;
}
server {
server_name i-manit.ru www.i-manit.ru;
listen 146.185.163.91;
disable_symlinks if_not_owner from=$root_path;
set $root_path /var/www/imanit_tver/data/www/i-manit.ru;
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
root $root_path;
access_log /var/www/nginx-logs/imanit_tver isp;
access_log /var/www/httpd-logs/i-manit.ru.access.log;
error_page 404 = @fallback;
client_max_body_size 100M;
}
location / {
proxy_pass 146.185.163.91:81;
proxy_redirect 146.185.163.91:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
proxy_pass 146.185.163.91:81;
proxy_redirect 146.185.163.91:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location @fallback {
proxy_pass 146.185.163.91:81;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ^~ /webstat/ {
auth_basic «Restricted area»;
auth_basic_user_file /var/www/imanit_tver/data/etc/1969352.passwd;
try_files $uri @fallback;
}
include /usr/local/ispmgr/etc/nginx.inc;
}
}
#mail {
# # See sample authentication script at:
# # wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities «TOP» «USER»;
# # imap_capabilities «IMAP4rev1» «UIDPLUS»;
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}

I
Ingtar, 2013-11-03
@Ingtar

try disabling tcp_nopush

N
neonox, 2013-11-03
@neonox

The error remained, but these logs
were written 5.143.172.103 — - [03/Nov/2013:23:05:39 +0400] "-" 408 0 "-" "-"
5.143.172.103 — - [03/Nov/2013 :23:05:39 +0400] "-" 408 0 "-" "-"
5.143.172.103 — - [03/Nov/2013:23:06:27 +0400] "-" 400 0 "-" "

N
neonox, 2013-11-03
@neonox

/etc/nginx/conf.d/*.conf; - the directory is empty
/etc/nginx/sites-enabled/*; - default -> /etc/nginx/sites-available/default

nginx.domain
server {
listen 146.185.163.91:443;
server_name 146.185.163.91;
ssl on;
ssl_certificate /usr/local/ispmgr/etc/manager.crt;
ssl_certificate_key /usr/local/ispmgr/etc/manager.key;
include /usr/local/ispmgr/etc/nginx.inc;
location / {
proxy_pass $mgr_proxy;
proxy_redirect $mgr_proxy /;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Secret bESRiYs0ISJHx60m/ypwyjvG;
chunked_transfer_encoding off;
}
location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
proxy_pass 146.185.163.91:81;
proxy_redirect 146.185.163.91:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Secret bESRiYs0ISJHx60m/ypwyjvG;
}
}

Increased the time to 1000, the file loaded completely, but then it gave a 500 error
[Sun Nov 03 23:37:00 2013] [warn] [client 5.143.172.103] mod_fcgid: HTTP request length 133905 (so far) exceeds MaxRequestLen (131072), referer: http://imanit.ru/administrator/index.php?option=com_jshopping&controller=update

I
Ingtar, 2013-11-03
@Ingtar

You know, what a crazy thought I have... Your requests are received by nginx, and then they are sent to port 81, where Apache sits... Or does it cut me like that by midnight :)
Is there any limit on the file size in php.ini? By default it's like 2 meters

S
stan_jeremy, 2013-11-03
@stan_jeremy

exceeds MaxRequestLen (131072)

this seems to be the minimum (default setting)
Try changing FcgidMaxRequestLen

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question