nginx DNS Resolver Configuration instance, this article explains the need to communicate in Proxy_pass and upstream server Specify the resolver manually, the configuration instance is given in this article. You need to specify resolver manually when communicating through Proxy_pass and upstream server. This error occurs at some point when the DNS resolution fails: Domain.com could not be resolved. You can specify multiple DNS and reset the domain name TTL to extend the Nginx parsing cache to ensure resolution success:   Resolver 223.5.5.5 223.6.6.6 1.2.4.8 114.114.114.114 valid=3600s ; If there are parsing errors, you can use DNSMASQ to build your own DNS locally, with the benefit of accelerated parsing: #/etc/dnsmasq.conf domain-needed Bogus-priv cache-size=51200 listen-address=127.0.0.1 #server =223.5.5.5 resolv-file=/etc/ resolv.conf It is also important to note that Proxy_pass does not parse every request, and if upstream IP frequently changes, it needs to be forced to parse: # via http:// forum.nginx.org/read.php?2,215830,215832#msg-215832 Resolver 127.0.0.1; Set $backend "foo.example.com"; proxy_pass http://$backend; |
[[email protected] ~]# Ping www.baidu.com
Ping:unknown Host Www.baidu.com
Solve:
First determine that the router is connected and the router has access to the extranet, which can be determined by accessing the gateway
[[email protected] ~]# Ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) bytes of data.
Bytes from 192.168.1.1:icmp_seq=1 ttl=64 time=2.96 ms
Bytes from 192.168.1.1:icmp_seq=2 ttl=64 time=1.75 ms
If you determine that the network is not a problem, you can find a workaround by following these steps:
1) Determine the domain name server is set, if not, it is recommended to set up Google's public DNS service, you can view the current DNS settings through cat/etc/resolv.conf
2) Make sure that the gateway is set and view through the route command
[Email protected] ~]# route
Kernel IP Routing Table
Destination Gateway genmask Flags Metric Ref use Iface
192.168.1.0 * 255.255.255.0 U 1 0 0 eth0
Default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
The gateway and DNS are all configured so that you can surf the Internet.
Nginx prompt host not found in upstream error resolution