🛠 Serveur web léger et conteneurs
Objectives
Turn the ODROID-C4 into a small home web server: serve a static site with nginx behind systemd, then isolate applications in Podman containers. The board's strengths for this role: 4 Cortex-A55 cores with Armv8 crypto extensions (accelerated SHA for TLS), Gigabit Ethernet, eMMC for I/O, and only ≈ 1.8 W at idle.
Hardware
- ODROID-C4 2 or 4 GB running Armbian current, booting from eMMC preferred (better endurance than microSD)
- Ethernet cable, fixed local IP (see the SSH tutorial)
- No direct Internet exposure without a reverse-proxy/firewall on the router side
sudo apt install -y nginx podman
Complete Code
#!/usr/bin/env bash
# 1) Site statique nginx
sudo mkdir -p /srv/www && echo '<h1>ODROID-C4 opérationnel</h1>' | sudo tee /srv/www/index.html
sudo tee /etc/nginx/sites-available/c4 >/dev/null <<'EOF'
server { listen 80; root /srv/www; index index.html;
location /health { return 200 "ok\n"; }
}
EOF
sudo ln -sf /etc/nginx/sites-available/c4 /etc/nginx/sites-enabled/c4
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t && sudo systemctl enable --now nginx && sudo systemctl reload nginx
# 2) Conteneur Podman (rootless) avec démarrage au boot
podman run -d --name wiki -p 8080:80 --restart=always nginx:alpine
sudo loginctl enable-linger $USER # garder les conteneurs au démarrage
# 3) Vérification
systemctl is-active nginx
Expected Verification
From a machine on the network: curl -i http://<IP-du-C4>/health returns HTTP/1.1 200 OK followed by ok, and the homepage displays in the browser. curl http://<IP>:8080 responds from the container. podman ps lists the container in Up state; after sudo reboot, both services come back without intervention thanks to enable and --restart=always.
Common Errors
nginx -tfails with "address already in use": a Python server or a second listener is occupying port 80; check withss -tlnp.- Forgetting to remove the nginx
defaultsite: it is the one responding instead of your vhost. - Docker on vendor kernel 4.9: prefer rootless Podman on Armbian mainline 6.6, fewer dependency surprises.
- Slow site on writes: the microSD saturates quickly — move /srv and databases to the eMMC module.
- Exposing port 80/443 on WAN without TLS or a reverse-proxy: stay local or use a tunnel; the board has no active firewall by default.
Other tutorials for this board
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash