【问题标题】:php7.2-fpm timeout nginx wsl 18.04php7.2-fpm 超时 nginx wsl 18.04
【发布时间】:2018-09-20 01:35:16
【问题描述】:

我最近从 Ubuntu wsl 16.04 升级到 18.04。

完成后,我恢复了本地开发,很高兴找到(几乎) 一切正常。

由于某种原因,我现在使用 php-fpm 遇到此错误

2018/09/19 21:17:26 [error] 3736#3736: *1 upstream timed out (110: Connection timed out) while reading upstream, client: ::1, server: _, request: "GET /register HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"

这里是我的 /etc/nginx/sites-available/default 文件的相关内容。

    location ~ \.php$ {
            include snippets/fastcgi-php.conf;

            # With php7.0-cgi alone:
            fastcgi_pass 127.0.0.1:9000;
            # With php7.0-fpm:
            #fastcgi_pass unix:/run/php/php7.2-fpm.sock;
            fastcgi_read_timeout 300;
    }

以及/etc/php/7.2/fpm/pool.d/www.conf中的相关行

listen = 127.0.0.1:9000

我还尝试取消注释 listen.allowed_clients = 127.0.0.1 但还是一样。

这里一定有我遗漏的东西。 www.conf 文件在升级过程中被重置为默认值,它必须在那里。非常感谢任何帮助。

【问题讨论】:

标签: ubuntu nginx fastcgi windows-subsystem-for-linux ubuntu-18.04


【解决方案1】:

解决方案是把它放在我的 nginx 配置的 location 块中:

fastcgi_buffering off;

在第一行

【讨论】:

    【解决方案2】:

    试试下面这个配置,来自github的Nginx

    location ~ \.php$ {
        proxy_set_header X-Forwarded-Proto $scheme;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_buffering off; # This must be here for WSL as of 11/28/2018
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PHP_VALUE "upload_max_filesize = 20M \n post_max_size=21M";
        include /etc/nginx/fastcgi.conf;
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-20
      • 2014-08-19
      • 2020-04-29
      • 1970-01-01
      • 1970-01-01
      • 2021-05-27
      • 2017-12-28
      • 1970-01-01
      相关资源
      最近更新 更多