PHP-FPM and Nginx: 502 Bad Gateway

后端 未结 15 1781
闹比i
闹比i 2021-01-29 18:35

Configuration

  • Ubuntu Server 11.10 64 bit
  • Amazon AWS, Ec2, hosted on the cloud
  • t1.micro instance

Before I write an

15条回答
  •  遥遥无期
    2021-01-29 19:09

    You should see the error log. By default, its location is in /var/log/nginx/error.log

    In my case, 502 get way because of:

    GET /app_dev.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "symfony2.local"
    2016/05/25 11:57:28 [error] 22889#22889: *3 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: symfony2.local, request: "GET /app_dev.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "symfony2.local"
    2016/05/25 11:57:29 [error] 22889#22889: *3 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: symfony2.local, request: "GET /app_dev.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "symfony2.local"
    2016/05/25 11:57:29 [error] 22889#22889: *3 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: symfony2.local, request: "GET /app_dev.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "symfony2.local"
    

    When we know exactly what is wrong, then fix it. For these error, just modify the buffer:

    fastcgi_buffers 16 512k; 
    fastcgi_buffer_size 512k;
    

提交回复
热议问题