← Questions

Host several websites on one server with one public IP

0
GoogleSystem designLast asked Feb 2026

A system design interview question asked in Google's first round (coding), last asked Feb 2026. It tests networking, dns and http.

You have a single Linux server with one public IPv4 address. A coffee shop, a butcher and an auto repair shop each want their own website at their own domain, for example coffee.example, butcher.example and auto.example. Explain how you would host all three on that one server.

Requirements

  • Functional: each domain shows its own site over HTTP and HTTPS; each owner can update their site.
  • Non-functional: valid TLS certificates for every domain, sites isolated from each other, logs per site, deployments that do not take the other sites down.

Clarifying questions

  • Are the sites static, or do they run application code (PHP, Node, Python)?
  • Who controls each domain's DNS?
  • How much traffic, and is downtime during deploys acceptable?
  • Do owners need shell access, or only a way to upload?

What a strong answer covers

  • DNS: an A record for each domain (and www) pointing at the same IP.
  • Routing HTTP: one web server or reverse proxy (nginx, Apache, Caddy) on ports 80 and 443 choosing the site by the Host header (name-based virtual hosts).
  • HTTPS: the TLS handshake happens before the Host header is seen, so Server Name Indication picks the certificate; one certificate per domain or one with several names; automatic issuance and renewal with Let's Encrypt (ACME HTTP-01 or DNS-01); redirect HTTP to HTTPS.
  • Isolation: each site's code under its own user or container, separate upstream processes behind the proxy, file permissions, resource limits so one busy site cannot starve the others.
  • Operations: per-site access and error logs, backups, zero-downtime config reloads, monitoring, firewall rules with only 80, 443 and SSH open.

Follow-ups

  • One site gets a traffic spike. How do you protect the other two?
  • A fourth customer wants a site that must not share a machine with anyone. What changes?
  • How would you do this without a server, with static hosting or containers in the cloud?

Where it's asked

  • Google · First round: coding · Last asked Feb 202645 min · Coding in a Google Doc, no syntax highlighting or autocomplete · No AI

What it tests

networking · dns · http

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing