Incus Apache Remote

Remote-Apache-Setup.

Remote-Verbindung einrichten

Auf Remote-Server

# Incus installieren
sudo apt install incus

# Incus konfigurieren
sudo incus admin init

# Netzwerk für Remote-Zugriff konfigurieren
sudo nano /etc/incus/config.yml
core:
  https_address: '[::]:8443'
  trust_password: 'your-password'
sudo systemctl restart incus

Auf lokalem Server

# Remote hinzufügen
incus remote add remote-server https://remote-server.com:8443 --accept-certificate --password=your-password

# Test-Verbindung
incus remote switch remote-server
incus list
incus remote switch local

Apache-Container auf Remote

# Container auf Remote erstellen
incus remote switch remote-server
incus launch ubuntu:22.04 remote-webserver

# Apache installieren
incus exec remote-webserver -- apt update
incus exec remote-webserver -- apt install -y apache2 php

# Port-Forwarding auf Remote
incus config device add remote-webserver http80 proxy listen=tcp:0.0.0.0:80 connect=tcp:127.0.0.1:80

Lokale Konfiguration

Reverse Proxy auf lokalem Server

nano /etc/nginx/sites-available/remote-proxy.conf
server {
    listen 80;
    server_name remote.example.com;

    location / {
        proxy_pass http://remote-server.com;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
sudo ln -s /etc/nginx/sites-available/remote-proxy.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Management

Remote-Container verwalten

# Remote-Container auflisten
incus remote switch remote-server
incus list

# In Remote-Container ausführen
incus exec remote-webserver -- systemctl status apache2

# Logs von Remote-Container
incus exec remote-webserver -- tail -f /var/log/apache2/access.log

Snapshots auf Remote

incus snapshot create remote-webserver backup-$(date +%Y%m%d)
incus list | grep snapshot

Zurück zur Container-Übersicht