I want to ask nginx a question.

  node.js, question

A rookie who has never used nginx wants to ask:

If my serv runs two nodejs program, one is localhost:3000 and that other is localhost:8080

Can I point the domain name a.com to localhost:3000 and the domain name b.com to localhost:8080?

server{
 listen 80;
 server_name  a.com ;
 
 location / {
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header Host $http_host;
 proxy_set_header X-NginX-Proxy true;
 proxy_pass http://127.0.0.1:3000;
 proxy_redirect off;
 bracket
 bracket
 
 server{
 listen 80;
 server_name  b.com ;
 
 location / {
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header Host $http_host;
 proxy_set_header X-NginX-Proxy true;
 proxy_pass http://127.0.0.1:8080;
 proxy_redirect off;
 bracket
 bracket