How do I host multiple Node.js sites on the same IP/server with different domains?

前端 未结 12 877
轻奢々
轻奢々 2020-11-28 01:03

I have a linux server with a single IP bound to it. I want to host multiple Node.js sites on this server on this IP, each (obviously) with a unique domain or subdomain. I wa

12条回答
  •  心在旅途
    2020-11-28 01:31

    Literally, when you get the request and response object, you can get the domain through "request.headers.host"... (not the IP address, actually the domain).

提交回复
热议问题