nginx - PHP-FPM - upstream prematurely closed connection while reading response header -
already saw same question - upstream prematurely closed connection while reading response header upstream, client jhilke dai said not solved @ , agree. got same exact error on nginx+phpfpm installation. current software versions: nginx 1.2.8 php 5.4.13 (cli) on freebsd9.1. bit isolated error , sure happened when trying import large files, larger 3 mbs mysql via phpmyadmin. counted backend closing connection when 30 secs limit reached. nginx error log throwing this
[error] 49927#0: *196 upstream prematurely closed connection while reading response header upstream, client: 7x.xx.x.6x, server: domain.com, request: "post /php3/import.php http/1.1", upstream: "fastcgi://unix:/tmp/php5-fpm.sock2:", host: "domain.com", referrer: "http://domain.com/phpmyadmin/db_import.php?db=testdb&server=1&token=9ee45779dd53c45b7300545dd3113fed"
my php.ini limits raised accordingly
upload_max_filesize = 200m default_socket_timeout = 60 max_execution_time = 600 max_input_time = 600
my.cnf related limit
max_allowed_packet = 512m
fastcgi limits
location ~ \.php$ { # fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass unix:/tmp/php5-fpm.sock2; include fastcgi_params; fastcgi_param script_filename $document_root$fastcgi_script_name; fastcgi_param script_name $fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_ignore_client_abort on; fastcgi_connect_timeout 60s; fastcgi_send_timeout 200s; fastcgi_read_timeout 200s; fastcgi_buffer_size 128k; fastcgi_buffers 8 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k;
tried change fastcgi timeouts buffer sizes, that's not helped. php error log doesn't show problem, enabled notices, warning - nothing useful. tried disable apc - no effect.
i had same issue, got 502 bad gateway , randomly @ development machine (osx + nginx + php-fpm), , solved changing parameters @ /usr/local/etc/php/5.6/php-fpm.conf:
i had settings:
pm = dynamic pm.max_children = 10 pm.start_servers = 3 pm.max_spare_servers = 5
... , changed them to:
pm = dynamic pm.max_children = 10 pm.start_servers = 10 pm.max_spare_servers = 10
... , restarted php-fpm service.
this settings based on found here: [https://bugs.php.net/bug.php?id=63395]
Comments
Post a Comment