Document Nginx Basic Auth setup for web deployment

This commit is contained in:
2026-03-02 20:18:54 +01:00
parent 06bce55514
commit 158ef648ee

View File

@@ -90,6 +90,8 @@ server {
server_name ics.example.de;
client_max_body_size 10M;
auth_basic "Geschuetzter Bereich";
auth_basic_user_file /etc/nginx/.htpasswd-pdf-to-ics;
location / {
proxy_pass http://127.0.0.1:8000;
@@ -109,6 +111,30 @@ sudo nginx -t
sudo systemctl reload nginx
```
### 2b) Basic Auth einrichten (empfohlen)
```bash
sudo apt-get update
sudo apt-get install -y apache2-utils
sudo htpasswd -c /etc/nginx/.htpasswd-pdf-to-ics kalender
sudo nginx -t
sudo systemctl reload nginx
```
Weitere Nutzer hinzufügen (ohne `-c`):
```bash
sudo htpasswd /etc/nginx/.htpasswd-pdf-to-ics weiterer_user
```
Schnelltest:
```bash
curl -I https://ics.example.de
```
Erwartung: zuerst `401 Unauthorized`, mit Login im Browser dann Zugriff.
### 3) HTTPS mit Let's Encrypt
```bash
@@ -125,6 +151,6 @@ sudo certbot renew --dry-run
### 4) Mindest-Sicherheit
- Zugriffe absichern (z. B. Basic Auth oder Login)
- Zugriffe absichern (mindestens Basic Auth)
- Upload-Limit klein halten (`client_max_body_size`)
- Server und Pakete regelmäßig aktualisieren