php7.2-fpm超时nginx wsl 18.04

时间:2018-09-20 01:35:16

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

我最近从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文件已重置为默认值,该文件必须位于其中。任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:1)

解决方案是将其放在我的nginx配置的位置块中:

{{ form|safe }}

第一行

答案 1 :(得分:0)

尝试以下来自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;

}