create a virtual host for each
server {
server_name sub1.example.com;
location / {
proxy_pass http://127.0.0.1:xxxx;
}
}
server {
server_name sub2.example.com;
location / {
proxy_pass http://127.0.0.1:xxxx;
}
}
And go on, change the port number to match the right port.