Publishing a Home Server through a VPS and SSH Tunnel

Server Notes

An OCI VPS serves as the public entry point for a home mail and web server, removing the need for port forwarding on the home router. The server applications and data remain on a Raspberry Pi at home.

OCI is used to keep relay costs down by running an eligible VM within its Always Free limits. Usage limits and idle VM reclamation conditions apply. See Oracle’s official documentation.

The Pi establishes an SSH connection to the VPS and uses remote port forwarding to create the relay path. HAProxy on the VPS forwards incoming traffic into the tunnel.

Internet → VPS / HAProxy → SSH tunnel → Home server

Because the Pi initiates the connection, the home router needs no port forwarding. The tunnel listeners on the VPS bind only to loopback addresses, with a dedicated SSH account and key restricting their use.

Incoming mail, IMAPS access and web traffic pass through the VPS. Outgoing mail uses an external SMTP relay. TLS termination and certificate management remain on the Pi, and PROXY protocol carries the original client IP address.

Public DNS records point to the VPS’s fixed IP address. If DDNS is used, its update targets must be kept separate so it does not overwrite these records with the home IP address.

Docker and the SSH tunnel are configured to start automatically and reconnect, with recovery checked after a reboot. Services still stop if the home server or connection goes down. The VPS only relays traffic; it does not store or queue mail.

As an Amazon Associate, nosubject.io earns from qualifying purchases. The books below are Japanese editions.

開発系エンジニアのためのDocker絵とき入門
開発系エンジニアのためのDocker絵とき入門
鈴木亮 / 秀和システム. View the Japanese edition on Amazon.co.jp.
www.amazon.co.jp
Podmanイン・アクション
Podmanイン・アクション
Daniel Walsh / 秀和システム. View the Japanese edition on Amazon.co.jp.
www.amazon.co.jp
Pythonではじめる生成AI時代のWebアプリ開発 FastAPI入門
Pythonではじめる生成AI時代のWebアプリ開発 FastAPI入門
掌田津耶乃 / 秀和システム新社. View the Japanese edition on Amazon.co.jp.
www.amazon.co.jp
Visual Studio Code 2026 パーフェクトマスター
Visual Studio Code 2026 パーフェクトマスター
金城俊哉 / 秀和システム新社. View the Japanese edition on Amazon.co.jp.
www.amazon.co.jp
わかりやすい Python
わかりやすい Python
川場隆 / 秀和システム新社. View the Japanese edition on Amazon.co.jp.
www.amazon.co.jp