View Original: http://www.ibloger.net/article/325.html
What happens if the Linux address is not ping?
Question: A paid item was written today. There is a class in which the HttpPost request is used. The address of the HTTP request is: Https://api.mch.weixin.qq.com/pay/unifiedorder
Found in the normal use of the machine, in the Linuxserver log is returned java.net.UnknownHostException: api.mch.weixin.qq.com
The first thing to think about is whether the server can access the external network normally, so use the ping command to test. Sure enough, it can't be used.
The way I solved it was to change the hosts file. Path /etc/hosts
to the file
First step: Get the IP address of the requesting address domain name on this computer
or use webmaster tools to get the IP address http://ip.chinaz.com/?IP=api.mch.weixin.qq.com, different IP addresses differ
Step Two: Change the ServerHost file
Add the IP address and domain name to the host file.
Save later. It's OK to ping the command.
Then my project will be able to access the network.
What happens if the Linux address is not ping?