Creating a dedicated web server VM
I started by spinning up a Debian VM inside TrueNAS. I only installed the essentials: a web server, SSH access, and no desktop environment. This kept the VM lightweight.
Apache was installed to serve the site..
Exposing the site securely
Instead of messing with port forwarding, I used Cloudflare Tunnel (cloudflared). This allows the VM to serve content to the internet securely without opening ports on my home network. The tunnel automatically handles HTTPS and forwards traffic from my domain to the Apache server.
- Installed
cloudflaredon the VM. - Created a named tunnel and linked it to my domain.
- Configured
config.ymlso the tunnel forwards requests. - Set the tunnel to run as a system service for automatic start at boot.
NFS share for easier updates
To make updating the site easier, I exported the Apache root directory via NFS. This lets me mount it on my PC and edit files directly. Any changes are immediately reflected on the server.
- NFS server installed on the Debian VM.
/var/www/htmlexported with read/write permissions over the LAN.- Mounted the share on my PC so I can edit the website files locally.
After updating files, simply reloading Apache (sudo systemctl reload apache2) applies the changes without restarting the VM or the tunnel.