ich brauche, um von extern auf meine Homematic zuzugreifen, einen Reverse Proxy um feindliche Zugriffe abzuwehren und den Zugriff zu limitieren. Desweiteren stelle ich damit auch intern Infoseiten wie benutzte IP-Adressen im Heimnetzwerk, Ports, Namen etc. zur Verfügung.
compose Datei
version: "3.8"
services:
apache2:
image: php:7.4-apache
ports:
- 81:80
- 444:443
volumes:
- /docker/data/volumes/apache2/www:/var/www/html
- /docker/data/volumes/apache2/logs:/var/log/apache2
- /docker/data/volumes/apache2/conf/httpsusers:/etc/apache2/httpsusers
- /docker/data/volumes/apache2/conf/chain.pem:/etc/apache2/chain.pem
- /docker/data/volumes/apache2/conf/cert.pem:/etc/apache2/cert.pem
- /docker/data/volumes/apache2/conf/privkey.pem:/etc/apache2/privkey.pem
- /docker/data/volumes/apache2/conf/modules.conf:/etc/apache2/mods-enabled/mn.conf
- /docker/data/volumes/apache2/conf/ssl.conf:/etc/apache2/conf-enabled/ssl.conf
- /docker/data/volumes/apache2/conf/hmproxy.conf:/etc/apache2/sites-enabled/hmproxy.conf
networks:
- traefik_proxy
deploy:
labels:
- traefik.enable=true
- traefik.docker.network=traefik_proxy
- traefik.http.routers.apache2.rule=Host(`apache2.beispiel.domain`)
- traefik.http.routers.apache2.entrypoints=http
- traefik.http.routers.apache2.service=apache2
- traefik.http.routers.apache2.middlewares=apache2-auth
- traefik.http.services.apache2.loadbalancer.server.port=80
- traefik.http.middlewares.apache2-auth.basicauth.users=USER:HASHPASSWORT
- traefik.http.routers.hmproxy.rule=Host(`hmproxy.beispiel.domain`)
- traefik.http.routers.hmproxy.entrypoints=https
- traefik.http.routers.hmproxy.service=hmproxy
- traefik.http.routers.hmproxy.middlewares=apache2-auth
- traefik.http.routers.hmproxy.tls=true
- traefik.http.services.hmproxy.loadbalancer.server.port=443
- traefik.http.middlewares.hmproxy-auth.basicauth.users=USER:HASHPASSWORT
networks:
traefik_proxy:
external: true
<code>
Ab jetzt kann apache in den folgenden Verzeichnissen konfiguriert bzw. mit Inhalten befuellt werden:
| NFS Pfad | Bemerkung |
|---|---|
| /docker/data/volumes/apache2/www | Webseiten, am Besten eine index.html oder index.php als Startseite |
| /docker/data/volumes/apache2/conf/httpsusers | Benutzer die berechtigt sind zuzugreifen, Format ist eine normale htpasswd datei |
| /docker/data/volumes/apache2/conf/modules.conf | Eventuell zusaetzlich benoetigte apache Module (z.B. mod_proxy) |
| /docker/data/volumes/apache2/conf/ssl.conf | Konfiguration fuer das ssl Modul mit Zertfikatspfaden, Ciohers etc |
| /docker/data/volumes/apache2/conf/hmproxy | Konfiguration meiner Proxy Seite |
| /docker/data/volumes/apache2/conf/*,pem | Die Bestandteile eines eventuell noetigen Zertfikats |
In dem Verzeichnis mit der compose Datei (in meinem Fall /docker/data/compose/apache2):
docker stack rm apache2 (Loeschen der alten Konfiguration) docker stack deploy -c mn-apache2.yml apache2 (Deploy des neuen Stacks/Services)