Upstream sent invalid status "-1 Copy failed" while reading response header from upstream

I have a joomla website and when I am trying to update a larger
extension I
get bad gateway (502) error.
I am able to update all small (normal) extensions.

I am getting this error in nginx error log: “upstream sent invalid
status
“-1 Copy failed” while reading response header from upstream”

I have checked the php-fpm log and there is nothing there connected to
this
particular error(I have it enabled in config).

All files and folders have www-data owner and proper permissions (I even
tried with 777).

There are parts of nginx.conf that I tried editing to fix this issue but
it
didn’t work:

http {

Basic Settings

fastcgi_read_timeout 5m;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
client_max_body_size 2M;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 6;
types_hash_max_size 2048;

CGI settings in sites-enabled conf:

pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ .php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
# NOTE: You should have “cgi.fix_pathinfo = 0;” in php.ini

# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;

# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;

}

I have tried searching this problem everywhere and tried many suggested
fixes but I am unable to fix this issue.

Interesting problem is that I think its connected to the file size which
I
am trying to update (its around 3MB only still but bigger than all
successfully updated extensions). The file (tar.gz gets updated
successfully
I think but after its being extracted or updated the error jumps)

My php.ini max_upload_size is 20M

Posted at Nginx Forum:

Hi,

Have you tried to increase your client_max_body_size to 3MB? Or
equivalent
with your php.ini configuration.

Hi,

Have you tried to increase your client_max_body_size to 3MB? Or at least
equivalent with your php.ini configuration.

On Sunday, October 26, 2014, NaZz <[email protected]

Hello, thank you for help.
Yes I have already tried that. (tried putting it to client_max_body_size
20M;)
My php post_max_size and max_upload_filesize are = 20M (for the sake of
fixing this problem)

Posted at Nginx Forum:

Hello!

On Sat, Oct 25, 2014 at 09:21:49PM -0400, NaZz wrote:

I have a joomla website and when I am trying to update a larger extension I
get bad gateway (502) error.
I am able to update all small (normal) extensions.

I am getting this error in nginx error log: “upstream sent invalid status
“-1 Copy failed” while reading response header from upstream”

The message suggests your upstream server returned an invalid
response, with “-1 Copy failed” in it instead of a valid HTTP
status. You have to dig into your upstream server to find out
what goes on there.


Maxim D.
http://nginx.org/

Where should I dig exactly? I am using Nginx with PHP-FPM and I have
checked
the logs but I can’t find anything. Where do I dig? I thought this is
connected to Nginx configuration?

Posted at Nginx Forum:

Hello!

On Mon, Oct 27, 2014 at 04:44:25PM -0400, NaZz wrote:

Where should I dig exactly? I am using Nginx with PHP-FPM and I have checked
the logs but I can’t find anything. Where do I dig? I thought this is
connected to Nginx configuration?

From nginx point of view, “your upstream server” is exact thing
to dig into. Anything more specific is beyond the scope of this
list.

Most likely, the problem is in the PHP code on the upstream
server, as I don’t think that PHP itself would return such invalid
response for any reason. But see above, it’s unrelated to nginx
and beyond the scope of this list.


Maxim D.
http://nginx.org/

NaZz Wrote:

If its unrelated to nginx why are people suggesting to edit various
settings in nginx.conf to fix this particular problem?

You can only do so much with config, the real problem here is the
upstream
(=backend).
nginx talks English <> your backend talks Russian
Somewhere your backend started talking a Russian dialect nginx don’t
understand, hence the need to fix your backend.

The hint " upstream sent invalid status " should say enough.

Posted at Nginx Forum:

I don’t understand this “upstream” “upstream” “upstream backend server”.
The upstream is served by fastcgi - fpm.sock on my own server. How do I
attend this problem?
Where do I dig exactly?

Posted at Nginx Forum:

If its unrelated to nginx why are people suggesting to edit various
settings
in nginx.conf to fix this particular problem?

Posted at Nginx Forum:

Okay, thank you…Sad story is that everything worked fine until I
updated
to latest Nginx version, that’s why I came here.
Oh well

Posted at Nginx Forum:

Maxim D. Wrote:

From nginx point of view, “your upstream server” is exact thing
to dig into.

Sounds like this Nginx guy you are talking about is the type of guy who
never wants to admit his mistakes. :smiley:

Posted at Nginx Forum:

I don’t understand this “upstream” “upstream” “upstream backend server”.
The upstream is served by fastcgi - fpm.sock on my own server. How do I
attend this problem?
Where do I dig exactly?

PHP or its FastCGI/FPM interface.