[Solved] nginx no resolver defined to resolve..

Try to find this problem when nginx uses different domain name proxy applications,
for example

listen 8888;
server_name www.test.com;

location ~ /testa {
      proxy_pass http://beta.test.com; #apache
} 

If IP is 127.0.0.1, an error will be reported

Asked the next Baidu need to set nginx resolver

The specific settings are as follows

The local MAC environment has been set


brew install  dnsmasq

vim /usr/local/etc/dnsmasq.conf

Open the following comments

domain-needed
bogus-priv
cache-size=51200
listen-address=127.0.0.1
resolv-file=/etc/resolv.conf

Start up

sudo brew services start dnsmasq

Add in nginx configuration

listen 8888;
server_name www.test.com;

location ~ /testa {
      resolver 127.0.0.1;
      proxy_pass http://beta.test.com; #apache
} 

Restart nginx again, and the access test is normal

Similar Posts: