我最近从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文件在升级过程中被重置为默认值,它必须在那里。任何帮助是极大的赞赏。
解决方案是将其放在我的nginx配置的位置块中:
fastcgi_buffering off;
在第一行
对于来自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;
}