Laptop

Self Hosting Domains – Proxmox on a Laptop

First ask yourself “why would you want to host your website at home when you can pay someone else to do it for you?” Like everything these days it comes down to cost. That is why I self host; to save myself money! I have not paid for web hosting over the last 20 years and I’ve learnt stuff along the way. This article is about self hosting domains using Proxmox.

Previously I wrote an article on self hosting using Webmin as your hosting manager, which is a great method for many people, but I grew out of it and have moved everything onto a Proxmox platform which gives me greater flexibility. Moving to Proxmox also meant I must dive deeper into Linux because I was no longer using any tools to help me edit configuration files. I’d be doing it all the old fashioned way – which might not be for you.

In my case I wanted each domain running within their own dedicated Linux server with separate IP addresses. I also needed the ability to have different software for different domains. Proxmox allows me to have CentOS on one, Ubuntu on another, Debian, Alpine, etc.

A few crappy laptops and built a flexible & reliable hosting platform.

Why laptops? That’s an easy question, because they have batteries which can be used like a UPS during power failures. It’s a double bonus, not only do you find a use for those crusty old laptops but you don’t need to purchase an Uninterrupted Power Supply. It’s a win win situation if you’re a cheapskate bastard like me.

This article is not a lesson on how to install, or set up, Proxmox but rather an overview of how I use it for hosting domains for myself and for a few friends.

IOT
Virtual Environments open a new world for you

Proxmox is a type-2 Hypervisor and gives you the ability to create multiple VM’s and LXC Containers. VM’s and containers are both similar and also dissimilar at the same time.

I don’t recommend using laptops to create VM’s unless they are for short term testing. Containers are very lightweight and each will have its own Operating System, IP address, firewall, etc. You can use pre-built containers or build your own from scratch. It’s a very flexible environment and requires very little knowledge to achieve great results. That suits me fine because I happen to have very little knowledge on anything useful.

Minimum hardware you’ll need

You will need at least one laptop or more depending on your needs. They don’t need to be fancy, fast or new. They must be multi-core with at least 4 Gig of memory. More memory & cores the better. They should also have at least a 1 Gig Ethernet port. The old 100 Mb ports will work but performance will be significantly degraded. Do not use wireless ever!

Obviously you can also use an old PC but I prefer laptops because batteries offer greater reliability.

Note:

If you want to use Clustering between laptops you will need two ethernet ports. Clustering allows you to seamlessly move containers & VM's between laptops. I don't use clustering but do use Proxmox Backup Server which gives me the same ability (just not in real time).

What I use here

I have five laptops in total, four of which have Proxmox VE installed, the other has Proxmox Backup Server running on it. Each laptop performs a specific task, for example; one for domains, another for name servers, etc.

Below is a run down of each, followed by an explanation;

Node 1 – ContainersOSCoresRAM/SwapHDRunning
7 Domains – separate containersDebian 1121 Gig5 GigNginx, MySQL, WordPress, Fail2ban
Online Shop – Under DevelopmentDebian 1121 Gig5 GigNginx, MySQL, WordPress, Woo-Commerce, Fail2ban
InvoicingDebian 1111 Gig4 GigNginx, Invoice Ninja, Fail2ban
Clean Server used for development & experimentsDebian 1121 Gig5 GigNothing, just a fresh Debian 11
Proxmox VE – 4 Cores – 8 Gig RAM

Each domain on Node 1 (above) runs in a separate container with unique IP addresses. Because we only get a few thousand hits per day we don’t need super fast. On another Proxmox machine we have Nginx configured as a reverse proxy. Its cache is effectively a RAM disk so it adds brilliant performance. Each time caching box is started it pre-loads & primes the cache with all domains for rapid response times. If I shutdown the box with domains on it, or take down a domain, the caching proxy will continue serving pages for a few hours which gives me time to perform maintenance without disrupting services.

Node 2 – ContainersOSCoresRAM/SwapHDRunning
DNSAlpine Linux2256 Mb2 GigBind 9 – Public facing
Pi-HoleDebian 112512 Mb5 GigPi-Hole internal private DNS
Zabbix ServerDebian 1121.5 Gig4 GigNginx, Invoice Ninja, Fail2ban
Proxmox VE – 4 Cores – 4 Gig RAM

The Node 2 machine (above) handles all names servers. The Bind 9 container handles our master Name Server and we use NS1 for secondaries. We use Alpine Linux because it is super lightweight and requires very few resources to run well. We use Pi-Hole for our internal Name Server and it handles resolution for other stuff inside the house such as TV and other devices.

Node 3 – ContainersOSCoresRAM/SwapHDRunning
Reverse ProxyAlma 8 Linux42 Gig5 GigNginx with all Caching in RAM
pre-loaded with all domains on Node 1
Proxmox VE – 4 Cores – 4 Gig RAM

For Node 3 (above) we wanted it dedicated for HTTP traffic. We use Nginx because it offers superior caching. All caching is done via memory rather than from the hard disk. A start up the cache is automatically primed with all domains. The cache used to run on a machine by itself but using a container allowed the Backup Server to make backups daily.

Node 4 – ContainersOSCoresRAM/SwapHDRunning
Proxmox Mail GatewayDebian 1122 Gig5 GigMail Smart Host handling mail for all seven
domains. Forwards incoming mail to internal
POP / IMAP mail server
Mail ServerDebian 1121Gig5GigPostfix, Dovecot
Handles all mail from domains and forwards
to Proxmox Mail Gateway as required
Proxmox VE – 4 Cores – 4 Gig RAM

Proxmox Mail Gateway should ideally run on its own rather than within a container but I didn’t want to dedicate a laptop for that purpose. PMG handles all mail into and out of the network. Mail passing all the required tests (spam, junk, etc.) is forwarded to our internal mail server which isn’t accessible from the outside world.

Dedicated LaptopOSCoresRAM/SwapHDRunning
Proxmox Backup ServerDebian 1122 Gig5 GigMail Smart Host handling mail for all seven
domains. Forwards incoming mail to internal
POP / IMAP mail server
Proxmox VE – 4 Cores – 4 Gig RAM

The Proxmox Backup Server does not utilise virtualisation and is dedicated to backup tasks. Each container across all Virtual Environments are automatically backed up twice per day. They are backed up using snapshot technology so they do not need to be shutdown while backing up.

Firewall

All containers have individual firewalls and all ports closed except for 80 and 22 for internal SSH access. 53 is also open and directed at the DNS. I recently added Zabbix Server for network monitoring and have opened the ports it requires. None of containers are directly accessible from the internet, with the exception of the mail server & Nginx reverse proxy (80 & 443).

I’d like to finish this article by sayomg Proxmox is a great solution to many problems and you should try it out for yourself.