Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
content:serverbasics:docker-caddy [2024/09/08 18:48] – [Create Caddy Yaml] Danielcontent:serverbasics:docker-caddy [2025/02/08 14:12] (aktuell) Daniel
Zeile 3: Zeile 3:
 Caddy is a powerful full featured webserver, which is also easy to use and setup. Caddy is a powerful full featured webserver, which is also easy to use and setup.
  
-In this guide i will show how to use Caddy as SSL- Proxy for your services to deliver them to the internet via name- based virtual hosting.+In this guide i will show how to use Caddy as SSL- Reverse- Proxy for your services to deliver them to the internet via name- based virtual hosting.
  
 ===== Prerequisites ===== ===== Prerequisites =====
Zeile 11: Zeile 11:
 ===== DNS- Records ===== ===== DNS- Records =====
  
-You will also need a domainname like ''my.domain.tld'' and hostnames, that are resolvable for each service, so that ''service.my.domain.tld'' can be resolved from out of - and in the internet to point to your Server. If you do not have them already, read further, which descripbes how to get them.+You will also need a domainname like ''my.domain.tld'' and hostnames, that are resolvable for each service, so that ''service.my.domain.tld'' can be resolved from out of - and in the internet to point to your Server. If you do not have them already, read here: [[.:network-dyndns|]]
  
 +When your service sucessfully resolves, you can use it in Caddy as written beneath.
  
-==== Register some Domain ==== 
- 
-There are many free Domainproviders out there. I chose dynv6 ( [[https://dynv6.com|https://dynv6.com]] ), but this should work with any of them. 
- 
-bla (not ready) blah - setup IPV4 , setup IPV6, bla link to [[.:network-dyndns|https://obel1x.de/dokuwiki/doku.php?id=content:serverbasics:network-dyndns|]] 
- 
-==== Define services ==== 
- 
-After that, create an A-Name record (or AAAA- Name for ipv6) per service without specifying the ip, som that the dynamic ip of the domain will be taken. Only paste the servicename, dynv6 will automagically append your domain (service → service.my.domain.tld) 
- 
-In our example this would be nice: 
- 
-''portainer'' → ''portainer.my.domain.tld'' 
 ===== Create Caddy Yaml ===== ===== Create Caddy Yaml =====
  
Zeile 35: Zeile 23:
 For me, this would be ''mkdir /srv/docker-compose/caddy'' \\ For me, this would be ''mkdir /srv/docker-compose/caddy'' \\
 Change to that directory and create the following docker-compose.yml file in it, putting in the following: Change to that directory and create the following docker-compose.yml file in it, putting in the following:
 +<file>
  
-<file> 
 services: services:
   caddy:   caddy:
Zeile 80: Zeile 68:
  
 Also, check that your Firewall has those Port 80 + 443 open on your host and that Port Forwarding in your Router is enabled for ipv4 and for ipv6. Also, check that your Firewall has those Port 80 + 443 open on your host and that Port Forwarding in your Router is enabled for ipv4 and for ipv6.
- 
  
 ===== Caddy Configuration ===== ===== Caddy Configuration =====
Zeile 86: Zeile 73:
 if you omit the Caddyfile, the server will already work, but we can directly Skip those tests and create the file ''Caddyfile'' in that folder too with the following content: if you omit the Caddyfile, the server will already work, but we can directly Skip those tests and create the file ''Caddyfile'' in that folder too with the following content:
 <file> <file>
 +
 https://portainer.my.domain.tld:443 { https://portainer.my.domain.tld:443 {
         header Strict-Transport-Security max-age=31536000;         header Strict-Transport-Security max-age=31536000;
Zeile 96: Zeile 84:
  
 Don't use localhost - see above. If you do not have a clue which hostname you have, better specify some fixed one which you can freely chose and edit ''/etc/hosts'' to have that name point to your local ip. Don't use localhost - see above. If you do not have a clue which hostname you have, better specify some fixed one which you can freely chose and edit ''/etc/hosts'' to have that name point to your local ip.
- 
- 
 ===== Fetch and run the Caddy Container ===== ===== Fetch and run the Caddy Container =====
  
 Thats all - use ''docker-compose up -d'' to start your container. In the Container- Logs you will see Caddy automagically create SSL- Certificates from lets encrypt if everything was setup the right way. Caddy will take care of renewal without the need to configure anything. Thats all - use ''docker-compose up -d'' to start your container. In the Container- Logs you will see Caddy automagically create SSL- Certificates from lets encrypt if everything was setup the right way. Caddy will take care of renewal without the need to configure anything.
  
-You now have a powerful proxy, that can transparently deliver your Dockers to the world with SSL- encryption enabled.+If the Caddy doe not return any Errors, you now have a powerful proxy, that can transparently deliver your Dockers to the world with SSL- encryption enabled.
  
  
  • content/serverbasics/docker-caddy.txt
  • Zuletzt geändert: 2025/02/08 14:12
  • von Daniel