docker部署Caddy服务器的文件共享服务
部署网站
# Caddyfile 需要参考下面官方的代码修改一下
docker run -d \
--name caddy_myprofile \
-p 8082:80 \
-p 8083:443 \
-v $PWD/Caddyfile:/etc/caddy/Caddyfile \
-v $PWD/caddy_data:/data \
-v $PWD/html:/var/www/html \
caddy
默认/etc/caddy/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
# Enable the static file server.
file_server
# 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
参考资料:
https://hub.docker.com/_/caddy
文件共享服务
docker run -d \
--name caddyfs \
-p 8080:80 \
-v /home/file:/www \
ionio/caddyfs
指令执行完成后,在浏览器访问IP:8080即可访问/home/file的文件
参考资料:
Docker镜像
https://hub.docker.com/r/ionio/caddyfs
GitHub地址
https://github.com/caddyserver/caddy
License:
CC BY 4.0