Nginx + php7.1-fpm,从上游读取响应标头时上游超时(110:连接超时)

Nginx + php7.1-fpm,从上游读取响应标头时上游超时(110:连接超时)

我在 Ubuntu 16.04 上安装了 Nginx 和 php7.1-fpm。一切运行正常。但现在我开始收到504 Gateway Time-out错误。

当我检查 Nginx 日志时,收到以下错误:

 *1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: server.name,, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.1-fpm.sock", host: "example.com", referrer: "http://example.com/"

这是我的虚拟主机文件

server {

    listen 80 default_server;
        listen [::]:80 default_server;

    server_name example.com;

    root /var/www/example/public;

        index index.html index.htm index.nginx-debian.html index.php;

        location / {

                 try_files $uri $uri/ /index.php?$query_string;

        }

    location ~ \.php$ {
            try_files $uri /index.php =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
                include fastcgi_params;
        }


    location ~ /\.ht {
                deny all;
        }
}

请指导我为什么会出现此错误。我该如何解决它。

相关内容