I wanted more control over my apps. So I built a home server—no cloud, no monthly fees, and no vendor lock-in. Here's how I did it step-by-step, what gear I used, and how you can replicate it with just a weekend and some old hardware.
Step 1: Buy a compact second-hand machine
I wanted a server that runs 24/7 and uses low power. I saw a compact PC for sale on the second-hand market for only PHP 3,000, so I immediately bought it.
Specs:
- 2-core, 4-thread CPU
- 8 GB RAM
- 256 GB NVMe SSD
It uses low power and runs 24/7 without issue. It’s enough for basic app hosting. Any unused laptop and or computer will do if it runs x64
Step 2: Install Ubuntu Server
To install Ubuntu Server, I downloaded the ISO image from their official website and created a bootable USB using Rufus. After installing, I connected the server to my local network via LAN cable and accessed it using SSH from my main computer.
Once installed, I SSH into it over the local network.
ssh username@192.168.1.123
Step 3: Installing Docker, Docker Compose, Tmux, Nvim and Cloudflared
Install essential packages:
sudo apt update
sudo apt install tmux cloudflared docker neovim
Follow Docker’s official guide if needed.
Step 4: Pull and build projects
I Cloned my own project from GitHub.
Use Docker Compose to build and run it on the server.
CI/CD is not set up yet. You test by accessing the local IP and port.
If it loads on the LAN, it’s ready for the web.
Step 5: Set up Cloudflare Tunnel
I bought a domain name for around PHP 140 for a year. Then, I installed Cloudflared, which allows me to expose my local server securely without port forwarding.
I pointed the DNS nameservers to Cloudflare’s, and after some propagation, it was ready.
Cloudflare now handles:
- DNS records
- SSL cert issuance
- Tunnel security
Start tunnel setup:
cloudflared login
Open the auth link, log in, and wait for the pem key to appear.
Create a tunnel:
cloudflared tunnel create tunnel
Edit the config: ~/.cloudflared/config.yml
nvim ~/.cloudflared/config.yml
or nano ~/.cloudflared/config.yml
Example config:
Route the tunnel to your domain:
cloudflared tunnel route dns my-tunnel sys-mon.wbert.xyz
Step 6: Run the tunnel
Use tmux to keep it alive in the background:
tmux new -s tunnel
cloudflared tunnel run tunnel
Detach with Ctrl+B
then D
.
Or, if you prefer, you can set it up as a service:
sudo cloudflared servers install
`
Final Thoughts
I now have a server running my personal projects with custom domains and HTTPS — all self-hosted and secure, without needing to expose my network to the internet directly. It’s satisfying and gives me full control over my setup.
Top comments (0)