执行 .\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](http://www.shuijingwanwq.com/wp-content/uploads/2018/10/1.png)
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

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

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

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

近期评论