解决nginx no resolver defined to r
2017-07-28 本文已影响0人
冰_茶
尝试在nginx通过不同域名代理应用时发现这个问题,
例如
listen 8888;
server_name www.test.com;
location ~ /testa {
proxy_pass http://beta.test.com; #apache环境
}
ip均为127.0.0.1 也会报错
问了下百度需要设置nginx resolver
具体设置如下
已本地mac环境设置
brew install dnsmasq
vim /usr/local/etc/dnsmasq.conf
把以下注释打开
domain-needed
bogus-priv
cache-size=51200
listen-address=127.0.0.1
resolv-file=/etc/resolv.conf
启动
sudo brew services start dnsmasq
在nginx配置中增加
listen 8888;
server_name www.test.com;
location ~ /testa {
resolver 127.0.0.1;
proxy_pass http://beta.test.com; #apache环境
}
再重启nginx访问测试正常