执行 .\nginx -s reload 时,提示:nginx: [emerg] host not found in upstream “api.aims-api.localhost” in C:/nginx-1.10.1/conf/vhosts/aims.conf:14 的分析解决

1、执行 .\nginx -s reload 时,提示:nginx: [emerg] host not found in upstream “api.aims-api.localhost” in C:/nginx-1.10.1/conf/vhosts/aims.conf:14,如图1

执行 .\nginx -s reload 时,提示:nginx: [emerg] host not found in upstream "api.aims-api.localhost" in C:/nginx-1.10.1/conf/vhosts/aims.conf:14
图1

2、查看 C:/nginx-1.10.1/conf/vhosts/aims.conf 的第13、14、15行



	location /v1 {
        proxy_pass http://api.aims-api.localhost/v1;
    }


3、查看 C:\Windows\System32\drivers\etc\hosts,发现 127.0.0.1 api.aims-api.localhost 已经被删除,原因在于 Windows 10 升级后导致



192.168.118.2 windows10.microdone.cn


4、将之前备份的 hosts 文件覆盖至 C:\Windows\System32\drivers\etc\hosts,如图2

将之前备份的 hosts 文件覆盖至 C:\Windows\System32\drivers\etc\hosts
图2

5、执行:ipconfig /flushdns,刷新 DNS 解析缓存,如图3

执行:ipconfig /flushdns,刷新 DNS 解析缓存
图3


ipconfig /flushdns


6、执行:.\nginx -s reload,未报错,如图4

执行:.\nginx -s reload,未报错
图4


.\nginx -s reload


7、查看进程,nginx.exe 已经存在,如图5

查看进程,nginx.exe 已经存在
图5

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理