'how to serve nginx as revers proxy with different domain

i have this project running and they are completely seperate with different domain name

0 project            planed domain name
1 localhost:1040     www.t1.com
2 localhost:2040     www.t2.com
3 localhost:3040     www.t3.com
4 localhost:4040     www.t4.com
5 localhost:5040     www.t5.com
6 localhost:6040     www.t6.com

how can i config my nginx to revers this domain name that are pointing to one ip address and how nginx detects what request is comming with what domain name thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source