Static Web Hosting¶
Lightweight Static Hosting
Static websites are served with nginx on Alpine Linux inside Incus containers. Each site gets its own container with a persistent storage volume mounted at /www. Deployment is automated via rsync over SSH using a dedicated CI key.
Alpine Linux Reference
This guide uses Alpine Linux. See the Alpine Linux Guide for reference on apk package management and OpenRC service management.
Two containers follow this pattern:
- www - Main website (this site, built with Zensical)
- retro - Retro-style version of the website
Install¶
Infrastructure Configuration¶
Each container gets a storage volume for the web content, mounted at /www.
resource "incus_storage_volume" "www" {
name = "www"
pool = incus_storage_pool.default.name
}
resource "incus_instance" "www" {
name = "www"
image = "images:alpine/3.21"
device {
name = "www"
type = "disk"
properties = {
path = "/www"
source = incus_storage_volume.www.name
pool = incus_storage_pool.default.name
}
}
}
resource "incus_storage_volume" "retro" {
name = "retro"
pool = incus_storage_pool.default.name
}
resource "incus_instance" "retro" {
name = "retro"
image = "images:alpine/3.23"
device {
name = "www"
type = "disk"
properties = {
path = "/www"
source = incus_storage_volume.retro.name
pool = incus_storage_pool.default.name
}
}
}
Container Setup¶
Run the following steps inside the container:
Configure nginx virtual host
The upstream /etc/nginx/nginx.conf is kept as-is. Create a virtual host file pointing to /www:
Enable and start services
Add CI deployment key
Deployment¶
Content is deployed from the Laminar CI server via rsync over SSH as the www user:
The laminar@laminar SSH key is authorized in /home/www/.ssh/authorized_keys on both containers, allowing automated deployment without a password.
Related Documentation:
- Infrastructure Overview - Complete self-hosting architecture
- Internet Connectivity - Reverse proxy and domain routing