Commit 80be39be authored by Alexander Bohn's avatar Alexander Bohn

adds HTTP Basic Auth for dev/staging environments

parent 27d4a03b
Pipeline #8307 failed with stages
in 2 seconds
# nginx-proxy Setup
## Staging-/DEV-Zugriffsschutz für `*.hebotek.at`
DEV- und Staging-Umgebungen unter `*.hebotek.at` sollen nicht öffentlich ohne Zugriffsschutz erreichbar sein.
Der Zugriffsschutz wird über **HTTP Basic Auth direkt am nginx-proxy** umgesetzt. Dadurch ist die gesamte jeweilige Umgebung geschützt, bevor Requests an die eigentliche Applikation weitergeleitet werden.
1. Passwortdatei lokal erzeugen:
```bash
docker run --rm httpd:alpine htpasswd -nb devuser 'PASSWORT' > *.hebotek.at
```
2. htpasswd-Datei auf Server kopieren:
```bash
nano ~/nginx-proxy/htpasswd/*.hebotek.at
```
3. vHost Config im nginx Volume anlegen:
```bash
docker exec -it nginx-proxy bash
cat > /etc/nginx/vhost.d/*.hebotek.at <<'EOF'
auth_basic "Staging geschützt";
auth_basic_user_file /etc/nginx/htpasswd/*.hebotek.at;
EOF
exit
```
4. nginx neu starten:
```bash
cd ~/nginx-proxy
docker-compose restart
```
\ No newline at end of file
......@@ -14,6 +14,7 @@ services:
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs
- ./html:/etc/nginx/html
- ./htpasswd:/etc/nginx/htpasswd:ro
- ./nginx-prod-settings.conf:/etc/nginx/conf.d/nginx-prod-settings.conf
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment