Two virtual hosts, TLS, and a reverse proxy
Topic 208 is weight 11 and names virtual hosts, TLS and reverse proxying. This guide serves two names from one address and proves each from a second machine, adds a self-signed certificate and reads the exact refusal a client gives it, then puts Apache in front of a backend bound to loopback - which the client can reach through the proxy and not directly.
202: HTTP Services Guide 24 of 29 Intermediate
- OSUbuntu 26.04 LTS
- Kernel7.0.0-30-generic
- systemd259
- Block devicesone 50 GB disk
- TimeAbout 28 min
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| LPIC2-A01 | 192.168.0.78 | Ubuntu 26.04 LTS | Primary service host - BIND, Apache, Samba, Postfix. Topic 204 RAID runs on loop devices; this machine has no spare disk | 2 Core | 4 GB | 50 GB |
| LPIC2-C01 | 192.168.0.80 | Ubuntu 26.04 LTS | Client - resolves, mounts and connects, so every service is proven from a machine that is not running it | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when one server has to host several sites, or when an application listening on a high port needs to be reachable over 443. This matters because name-based virtual hosting depends on a header the client sends, and because a certificate that works with -k and fails without it is telling you something specific about trust rather than about encryption.
- serving two names from one address, and seeing each log its own requests
- validating the configuration with
configtestbefore every reload - adding TLS with a self-signed certificate, and reading the client's refusal
- proxying a loopback-bound backend, and proving it is unreachable directly
- removing every site, module and certificate, and counting the listeners
Before you start
- a-web-server-on-both-families
-
One address, two names, two sites
-
Asking for each name, from the other machine
-
The same site over TLS
-
A reverse proxy in front of something else
-
Putting the machine back