It is strongly recommended to use nginx to host frontend static resources and reverse proxy backend service. The configuration is as follows:

server {

  listen 8000;
  server_name localhost;
  set $node_port 7002;

  root /path/to/project/dist;

  location /public {
    root /path/to/home/cabloy/project-name;
    internal;
  }

  location /api/ {
    proxy_http_version 1.1;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $server_name;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass http://127.0.0.1:$node_port$request_uri;
    proxy_redirect off;
    proxy_buffer_size 64k;
    proxy_buffers   4 32k;
    proxy_busy_buffers_size 64k;
  }

}
Name Description
root frontend static resources
location /public resource files generated during system operations, such as uploaded pictures, uploaded files, etc.
location /api/ backend service