nginx -t "host not found in upstream"错误的解决方法

发布时间:2020-07-01编辑:脚本学堂
错误信息如下:# nginx -t nginx: [emerg] host not found in upstream "sns.onbobo.local" in /etc/nginx/nginx.conf:87
nginx: configuration file /etc/nginx/nginx.conf test failed

错误信息如下:
# nginx -t
nginx: [emerg] host not found in upstream "sns.onbobo.local" in /etc/nginx/nginx.conf:87
nginx: configuration file /etc/nginx/nginx.conf test failed

分析:
语法上没有错误,只是系统无法解析这个域名,所以报错。

解决办法:
添加dns到/etc/resolv.conf 或者是/etc/hosts,让其能够解析到IP即可。