Caddy File Server Docker部署

Caddy File Server Docker部署

1. 切换到应用的文件夹下面

$ cd /alidata1/admin/app/caddy

2. 编辑docker-compose.yml

version: "3.7"

services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    ports:
      - "8888:80"
      - "4433:443"
      - "4433:443/udp"
    volumes:
      - $PWD/Caddyfile:/etc/caddy/Caddyfile
      - $PWD/site:/srv
      - caddy_data:/data
      - caddy_config:/config

volumes:
  caddy_data:
    external: true
  caddy_config:

3. 编辑Caddyfile

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.

:80 {
        # Set this path to your site's directory.
        # root * /usr/share/caddy
        root * /srv

        # Enable the static file server.
        file_server browse

        # Another common task is to set up a reverse proxy:
        # reverse_proxy localhost:8080

        # Or serve a PHP site through php-fpm:
        # php_fastcgi localhost:9000
}

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

4. 创建volume

$ docker volume create --name=caddy_data

5. 拉起服务

$ docker-compose up -d

6. 检查服务运行状态

$ docker ps
posted on 2022-10-25 16:19  JentZhang  阅读(660)  评论(0)    收藏  举报