nginx 解决 No connection could be made because the target machine actively refused it

已经搭建好的环境突然全部nginx502,localhost拒绝访问

报错信息:

connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client:

 

打开cmd,在cmd中 ping 127.0.0.1 会出现下图情况。

 

 

ping 解析出来的是 IPV6 的::1,原因是windows有个优先解析列表,当ipv6的优先级⾼于ipv4时,就会出现这种情况。

执行命令:netsh interface ipv6 show prefixpolicies

 

解决办法:修改优先解析表让 ipv4 优先级高于ipv6的记录。方法如下:

 

依次逐⾏复制下⾯命令执⾏,调整顺序

netsh int ipv6 set prefix ::/96 50 0

netsh int ipv6 set prefix ::ffff:0:0/96 40 1

netsh int ipv6 set prefix 2001::/32 30 3

netsh int ipv6 set prefix ::1/128 10 4

netsh int ipv6 set prefix ::/0 5 5

调整后执⾏ netsh interface ipv6 show prefixpolicies 检查⼀下 重启电脑 ⽤得好好的,

 

原文出处:【无标题】nginx 502 解决 No connection could be made because the target machine actively refused it_nginx no connection could be made because the targ-CSDN博客

posted @ 2024-05-21 17:06  hello_stone  阅读(4982)  评论(0)    收藏  举报