upstream prematuramente fechado durante a leitura do cabeçalho de resposta do upstream 502 Bad GateWay

6

nginx está me matando .. então agora eu tenho 502 Bad Gateway. log de erro diz:

2016/10/12 17:39:53 [info] 3023#0: *464 client closed connection while waiting for request, client: 127.0.0.1, server: 0.0.0.0:443
2016/10/12 17:39:53 [info] 3023#0: *465 client closed connection while waiting for request, client: 127.0.0.1, server: 0.0.0.0:443
2016/10/12 17:39:55 [error] 3023#0: *459 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: local.beerhawk.co.uk, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "local.mydomain.co.uk"

meu arquivo conf ngninx agora se parece com isto:

#user  RobDee;
worker_processes  auto;

#error_log  logs/error.log;
#error_log  logs/error.log  info;
pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  #main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

     access_log  logs/access.log;
     error_log  logs/error.log;
    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;


    server {
        listen       80;
        server_name  default;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /Users/RobDee/workspace/beerhawk/web;
            index  index.html index.htm;
        }

    # HTTPS server


   server {
    listen                     443 ;
    server_name                local.mydomain.co.uk local.beer.telegraph.co.uk;

    ssl                        on;
    ssl_protocols              TLSv1 TLSv1.1 TLSv1.2;
    ssl_certificate            /usr/local/etc/nginx/cert.pem;
    ssl_certificate_key        /usr/local/etc/nginx/cert.key;

    gzip_disable "msie6";
    gzip_types text/plain application/xml application/x-javascript text/css application/json text/javascript;

    access_log  /usr/local/var/log/nginx/access.log;
    error_log   /usr/local/var/log/nginx/error.log debug;
    log_not_found off;
    root    /Users/RobDee/workspace/beerhawk/web;

    location /.htpasswd
    {
        return 403;
    }
    location ~ \.css {
        root /Users/RobDee/workspace/beerhawk/web;
        expires max;
    }

    location ~* \.(jpg|jpeg|png|gif|ico|js|woff|woff2|ttf)$ {
        root /Users/RobDee/workspace/beerhawk/web;
        access_log off;
        expires max;
    }

    location ~* \.(js|css)$ {
        expires 1y;
        log_not_found off;
    }

    location /
    {
        try_files $uri $uri/ /app_dev.php$is_args$args;
        index index.php app_dev.php;
    }

    location ~ \.php$ {
        #root /Users/RobDee/workspace/beerhawk/web;
    fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  app_dev.php;
        fastcgi_param  SCRIPT_FILENAME  $request_filename;
        include        fastcgi_params;
        #fastcgi_read_timeout 3000;

    }
    }

    include servers/*;

    }

Eu não tenho idéia do que estou fazendo de errado ... alguém poderia me ajudar pls

    
por RobDee 12.10.2016 / 18:03

1 resposta

0

Por quanto tempo seus aplicativos levam para responder?

Nós vemos erros semelhantes a estes quando o cliente excede a conexão:

2016/10/12 17:39:53 [info] 3023#0: *465 client closed connection while waiting for request, client: 127.0.0.1, server: 0.0.0.0:443

Por exemplo, se uma instância de verniz expirar em 10s, enquanto o nginx espera por 30s por uma resposta do PHP, o verniz terminará a conexão antes que o Nginx possa responder.

O erro upstream prematurely closed connection pode ser nginx terminando a conexão com o PHP. Não tenho 100% de certeza, pois não me lembro de ter lidado muito com esse erro!

Espero que ajude OP:)

    
por 30.08.2017 / 15:29