My bad, in one location I forgot to remove port, that is why nginx tried to resolve upstream as hostname. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,249142,249145#msg-249145