Difference between socket- and port-based connection to outer NGINX?

You need to put the whole location block inside the server block.