Nginx + PhpFpm + phpmyadmin 上游超时(110:连接超时)和 recv() 失败(104:对等方重置连接)错误

Nginx + PhpFpm + phpmyadmin 上游超时(110:连接超时)和 recv() 失败(104:对等方重置连接)错误

我在 Nginx + Phpfpm 7.1 设置上遇到连接超时和对等错误 503 重置连接的情况。

2018/06/28 14:32:13 [error] 2428#2428: *45 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.10.1, server: , request: "GET /phpmyadmin/db_structure.php?server=1&db=britam HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.1-fpm.sock", host: "192.168.10.192"
2018/06/28 14:39:01 [error] 2428#2428: *51 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.10.1, server: , request: "GET /phpmyadmin/ HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.1-fpm.sock:", host: "192.168.10.192"
2018/06/28 14:41:01 [error] 2428#2428: *56 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.10.1, server: , request: "GET /phpmyadmin/db_structure.php?server=1&db=britam&ajax_request=true&ajax_page_request=true&_nocache=1530196749597737784&token=yYGJ2q%2FE_%2BD6v!Wg HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.1-fpm.sock:", host: "192.168.10.192"

我知道我已经在 Google 上搜索了很久,并采纳了各种建议,比如在 /etc/php/7.1/fpm/pool.d/www.conf 中设置 request_terminate_timeout=30s 或更长,在 /etc/php/7.1/fpm/php.ini 中设置 max_execution_time = 30,最后在 nginx 配置中的服务器部分设置 fastcgi_read_timeout 300;,然后重新启动 Nginx 和 Phpfpm 服务。所有这些选项都不起作用。

这是我的 Nginx 配置;

server {
    listen   80 default_server;

    access_log /var/log/nginx/phpmyadmin_access.log;
    error_log /var/log/nginx/phpmyadmin_error.log;

    # Main application:
    root /var/www/html;
    index index.php index.html index.htm;

    # phpMyAdmin:
    location /phpmyadmin {
        root /usr/share;
        index index.php;
    }
    # PHP files for phpMyAdmin:
    location ~ ^/phpmyadmin(.+\.php)$ {
        root /usr/share;
        index index.php;
        #fastcgi_read_timeout 300;
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
    }

    # PHP files for the main application:
    location ~ \.php$ {
        fastcgi_read_timeout 300;
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
    }
}

相关内容