Caddy 配置自动配置https 和 docker启动ssh

Caddyfile

1
2
3
4
5
6
7
8
go.kenhong.com {
	root * /srv
    encode {
        zstd
        gzip 9
    }
	file_server
}

docker-compose.yml

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
version: '3.2'

services:
  openssh-server:
    image: linuxserver/openssh-server:latest
    container_name: openssh-server
    hostname: openssh-server #optional
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Shanghai
      - SUDO_ACCESS=false #optional
      - PASSWORD_ACCESS=true #optional
      - USER_PASSWORD=${USER_PASSWORD}
      - USER_NAME=${USER_NAME} #optional
    volumes:
      - ./config:/config
      - ./www:/config/www
    ports:
      - ${SSH_PORT}:2222
    restart: unless-stopped

  caddy:
    image: caddy:2-alpine
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - ./www:/srv
      - ./caddy_data:/data
      - ./caddy_config:/config