🛠 Héberger un service web léger (nginx et conteneurs)

Orange Pi PC (Allwinner H3) · avance · Schéma : IMG-orangepi-pc-avance-3-opipc-serveur-web-leger.svg — Orange Pi PC sous Armbian servant nginx en service systemd derrière un routeur 10/100, conteneurs Docker optionnels (Pi-hole, Home Assistant), logs détournés vers RAM pour ménager la microSD.

Objectives

Turn the Orange Pi PC into a small permanent server: 1 GB of RAM, four Cortex-A7 and a 100 Mbit/s Ethernet link are more than enough for nginx, an ad blocker like Pi-hole or small containers — the use cases Armbian documentation documents for this board. The real subject of a server on an SBC is not the server, it is longevity: fragile microSD and power supply, hence log2ram and sober services.

Hardware

Full code

  1. static nginx as a systemd service:
sudo apt install -y nginx
sudo tee /etc/nginx/sites-available/projet <<'EOF'
server {
    listen 80;
    server_name _;
    root /srv/www/projet;
    location / { try_files $uri $uri/ =404; }
    # Réduire les écritures disque : logs vers stderr (journald, log2ram)
    access_log /dev/stderr;
    error_log /dev/stderr;
}
EOF
sudo mkdir -p /srv/www/projet
echo '<h1>Orange Pi PC opérationnel</h1>' | sudo tee /srv/www/projet/index.html
sudo ln -sf /etc/nginx/sites-available/projet /etc/nginx/sites-enabled/default
sudo nginx -t && sudo systemctl reload nginx
  1. first container (the ARMv7 registry is labelled arm32v7/armhf):
sudo systemctl enable --now docker
docker run -d --name whoami --restart unless-stopped -p 8080:80 traefik/whoami
curl -s localhost:8080 | head -3
# Limiter l'empreinte : logs JSON sur petit fichier, rotation agressive
sudo tee /etc/docker/daemon.json <<'EOF'
{ "log-driver": "json-file", "log-opts": { "max-size": "1m", "max-file": "1" } }
EOF
sudo systemctl restart docker
  1. Backup: tar of the configs + card cloned regularly (dd | gzip).

Expected verification

curl localhost returns the page; from another machine, http://IP-de-la-carte too. docker ps shows the container in restart unless-stopped and it restarts on its own after reboot. The temperature stays below the throttling zone at idle (nginx alone barely heats).

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials