Is it possible/practical to host multiple websites from the same VPS server?

I have a number of domains (for example): bilbobaggins.com, rx4free.com, mypersonalblog.com

I don’t get much traffic and I’m not interested in paying for separate servers for each domain. But I still want https certificates to work properly.

Now I’m familiar with setting up wildcard subdomains with traefik and letsencrypt. But can I do the same or similar with completely different domains such as listed above?

  • taladar
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    That is absolutely possible. You just need to point all the domain names to the IPv4 (via the A record) and IPv6 (via the AAAA record) addreses of your VPS and then configure virtual hosts in e.g. nginx or Apache httpd or Traefik with a so called name based virtual hosts that each listen on those IPs (or all IPs of the VPS for simplicity with a listen IP like :: for IPv6 and IPv4 or 0.0.0.0 for just IPv4) and configure each domain as the name for one virtual host you want to serve different content. You then configure SSL/TLS in each virtual host separately with the certificate for that name.

    You can, of course, also use some ACME based free certificates from a CA like Let’s Encrypt.

    On a technical level the server listening on the HTTPS port (443 TCP) will use the name from the TLS handshake’s Server Name Indication (SNI) field to decide which certificate to present.