This question sounds almost too simple until you actually try to explain all the moving parts in sequence.
Start by clarifying requirements and constraints, then walk through the full stack from DNS to HTTPS, explaining how name-based virtual hosting with a reverse proxy (e.g., Nginx) solves the problem. Compare port-based vs. name-based approaches, highlighting trade-offs in scalability, user experience, and certificate management.
Pro tip: Emphasize that name-based virtual hosting is the industry standard because it allows unlimited domains on a single IP and port, and mention that SNI (Server Name Indication) is essential for per-domain HTTPS certificates without dedicated IPs.
Confirm that each site needs its own domain, HTTPS, and that only one public IP is available. Ask about expected traffic, scalability, and whether the sites are independent or related.
Create A records for each domain pointing to the single public IP. Optionally, use CNAME records for subdomains or aliases.
Install a reverse proxy like Nginx or Apache. Configure name-based virtual hosts: each server block matches the incoming Host header and forwards requests to the appropriate backend application (e.g., Node.js, Python) running on different local ports.
Obtain TLS certificates for each domain (e.g., via Let's Encrypt). Configure the reverse proxy to use SNI to present the correct certificate based on the requested hostname. Redirect HTTP to HTTPS.
Compare name-based vs. port-based virtual hosting: name-based is transparent to users (standard ports) and scales well, but relies on Host header/SNI; port-based requires users to specify ports and is less user-friendly, but can work without SNI. Mention that name-based is preferred for production.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.