nginx报502修复日志 upstream prematurely closed

nginx错误日志

    2020/08/16 20:22:06 [error] 288416#288480: *1 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /aa.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost", referrer: "http://localhost/"
  • 1

然后我想是不是9000端口被占用了(临时想出来的),然后打开cmd窗口

这里写图片描述

       我们看到是PID是300884,然后输入命令:tasklist | findstr “301816”

这里写图片描述

原来是IDE占用了9000端口(IDE故意的吧,偏偏每次都默认占用这个端口)。这下问题好解决了,先把ide关闭,再重启nginx,然后再开IDE(一定要在nginx启动之后)。再去打开postman请求本地接口,一切又正常了 ヽ( ̄▽ ̄)ノ

转载自:https://blog.csdn.net/abel004/article/details/77985458

原文地址:https://www.cnblogs.com/foreversun/p/13516043.html