this post was submitted on 07 Jul 2023
6 points (100.0% liked)

Self Hosted - Self-hosting your services.

11211 readers
1 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules

Important

Beginning of January 1st 2024 this rule WILL be enforced. Posts that are not tagged will be warned and if not fixed within 24h then removed!

Cross-posting

If you see a rule-breaker please DM the mods!

founded 3 years ago
MODERATORS
 

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?

all 4 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 1 year ago (1 children)

Typical web servers like Apache and Nginx support virtual hosts (aka server blocks in Nginx terminology)

[–] [email protected] 1 points 1 year ago

I use virtual hosts frequently with Apache, it's definitely a good way to go.

[–] taladar 1 points 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.