Windows WSL 中安装的 Nginx / PHP-FPM 超时问题

发布时间: 2018-11-08 09:45:37 作者: 大象笔记

WSL 中搭建了一套 Nginx PHP-FPM 环境,但是在浏览器中访问 http://localhost 永远会超时。

错误日志如下

2018/11/08 09:22:49 [error] 1322#1322: *7 upstream timed out (110: Connection timed out) while reading upstream, client: 127.0.0.1, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.1-fpm.sock:", host: "localhost"

去掉 PHP-FPM,直接访问 nginx 的默认欢迎页,一切正常。

在 github 的 WSL 项目 issue 中找到了解决方案

即,在 /etc/nginx/nginx.conf 的 http block 中加入

fastcgi_buffering off;

然后,reload nginx

sudo nginx -s reload

即可。

但是原理不明 。。。

我是一名山东烟台的开发者,联系作者