Kapitel 7/Tutorial.md aktualisiert

This commit is contained in:
2025-09-04 10:37:42 +00:00
parent 68ec48c808
commit 68241b2cca

View File

@@ -184,3 +184,181 @@ systemctl restart redis-server
Fertig. Jetzt ist Redis bereit für Nextcloud Caching und Locking funktionieren nach dem Setup automatisch, Fertig. Jetzt ist Redis bereit für Nextcloud Caching und Locking funktionieren nach dem Setup automatisch,
wenn wir die Einträge in der `config.php` ergänzen. wenn wir die Einträge in der `config.php` ergänzen.
## ⬇️ Nextcloud herunterladen
[Platzhalter: Warum wir Nextcloud manuell installieren (Version kontrollieren, Updates nachvollziehbar, keine Snap/FPM-Probleme).]
### Download & Entpacken
```bash
cd /srv/nextcloud/app
curl -LO https://download.nextcloud.com/server/releases/nextcloud-29.0.1.zip
unzip nextcloud-29.0.1.zip && rm nextcloud-29.0.1.zip
chown -R www-data:www-data nextcloud
```
> [!NOTE]
> Aktuelle Version prüfen: https://nextcloud.com/changelog/
---
## ⚙️ `config.php` vorbereiten
[Platzhalter: Warum wir die Datei *vorher* anlegen (Proxy-Erkennung, Redis, saubere Setup-Erfahrung).
Wird beim ersten Aufruf automatisch ergänzt.]
### Datei erstellen
```bash
nano /srv/nextcloud/app/nextcloud/config/config.php
```
### Inhalt einfügen
```php
<?php
$CONFIG = array (
'trusted_domains' => [
'cloud.DEINE-DOMAIN.tld',
],
'overwrite.cli.url' => 'https://cloud.DEINE-DOMAIN.tld',
'overwritehost' => 'cloud.DEINE-DOMAIN.tld',
'overwriteprotocol' => 'https',
'trusted_proxies' => ['IP.DEINES.NPM'],
'filelocking.enabled' => true,
'memcache.local' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' => [
'host' => '/var/run/redis/redis-server.sock',
'port' => 0,
'timeout' => 1.5,
],
);
```
> [!TIP]
> `trusted_proxies` kann z.B. `10.0.0.1` sein, wenn NPM im selben Netz läuft.
> Mehrere Proxies können als Array ergänzt werden.
---
Damit ist Nextcloud bereit gleich folgt der Abschnitt zur **Nginx-Konfiguration**.
## 🌐 Nginx konfigurieren (vHost intern)
[Platzhalter: Warum wir keinen HTTPS/SSL im Container brauchen (TLS wird von NPM übernommen).
Nginx hier nur als lokaler Webserver für PHP-FPM + Nextcloud.]
### Neue Konfigurationsdatei anlegen
```bash
nano /etc/nginx/sites-available/nextcloud.conf
```
### Inhalt einfügen
```nginx
server {
listen 80;
server_name cloud.DEINE-DOMAIN.tld;
root /srv/nextcloud/app/nextcloud;
index index.php index.html;
client_max_body_size 10G;
fastcgi_buffers 64 4K;
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/(?:\.htaccess|data|config|db_structure\\.xml|README) {
deny all;
}
location ~ \\.php(?:$|/) {
include fastcgi_params;
fastcgi_split_path_info ^(.+\\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
}
```
### Site aktivieren
```bash
ln -s /etc/nginx/sites-available/nextcloud.conf /etc/nginx/sites-enabled/
rm /etc/nginx/sites-enabled/default
nginx -t && systemctl reload nginx
```
> [!NOTE]
> `nginx -t` prüft die Konfiguration. Nur wenn „syntax is ok“ erscheint, darfst du reloaden.
---
Sobald das erledigt ist, folgt der Abschnitt für **NPMProxy + Domain-Setup**.
Sag einfach, wann du soweit bist oder wenn du auf ein Problem triffst.
## 🌍 NPM-Proxy konfigurieren
[Platzhalter: Warum wir Nginx Proxy Manager verwenden (TLS-Termination, zentraler Reverse Proxy, Lets Encrypt, Portweiterleitung).
Nextcloud selbst kennt nur HTTP und läuft im LXC ohne Zertifikat.]
### Im Nginx Proxy Manager (Web-GUI):
1. Gehe auf **Hosts → Proxy Hosts → Add Proxy Host**
2. Trage ein:
| Feld | Wert |
|-----------------------|---------------------------------|
| **Domain Names** | `cloud.DEINE-DOMAIN.tld` |
| **Forward Hostname/IP** | `<IP deines Nextcloud-LXC>` |
| **Forward Port** | `80` |
| **Access** | Websockets aktivieren ✅ |
| **SSL** | → **Request a new SSL Certificate**
| | → **Force SSL** aktivieren ✅
| | → **HTTP/2 Support** aktivieren ✅
> [!TIP]
> Trage bei „E-Mail“ eine gültige Adresse ein, sonst schlägt das Zertifikat fehl.
> HSTS kannst du bei Bedarf aktivieren (empfohlen).
### (Optional) Für große Uploads:
Reiter „Advanced“:
```nginx
client_max_body_size 10G;
proxy_read_timeout 3600;
proxy_send_timeout 3600;
```
---
**Jetzt testen:**
Öffne im Browser:
```
https://cloud.DEINE-DOMAIN.tld
```
Du solltest den **Nextcloud-Setup-Assistenten** sehen ohne Fehlermeldung, ohne Mixed Content.
Falls du eine Nginx-Standardseite siehst: Proxy nicht korrekt → prüfe Domain, IP und Port.
---