解决 nginx 启动错误"nginx: [emerg] host not found in upstream "

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Hreticent/article/details/86074502

利用nginx进行反向代理的时候,我们会配置proxy_pass。在启动nginx的时候,会报如下错误:

nginx: [emerg] host not found in upstream "xxx.com" in /usr/local/nginx/conf/vhost/yq.nginx.com.conf:19

其实nginx配置语法上没有错误的,只是系统无法解析这个域名,所以报错.
解决办法就是添加dns到/etc/resolv.conf 或者是/etc/hosts,让其能够解析到IP。类似windows下的hosts文件的修改。

具体步骤如下:

vim /etc/hosts

//修改hosts文件,在hosts文件里面加上一句:

127.0.0.1       localhost.localdomain   xxx.com


 

猜你喜欢

转载自blog.csdn.net/Hreticent/article/details/86074502
今日推荐