1. Caddy version (caddy version
):
v.2.4.6.
2. How I run Caddy:
Installed with the caddy instructions for Debian Bullseye, with repository.
a. System environment:
DietPi aarch64 Debian Bullseye on Rock64 - Pine SBC.
Caddy runs on systemd but my server “Seafile for ARM” is running in a Docker-Container.
b. Command:
sudo systemctl start caddy
c. Service/unit/compose file:
version: '3.3'
services:
seafile:
image: franchetti/seafile-arm
restart: always
environment:
- PUID=1000
- PGID=1000
- SERVER_IP=my.domain
- SEAFILE_ADMIN_EMAIL=mymail@domain
- SEAFILE_ADMIN_PASSWORD=password
- ENABLE_TLS=1
- MYSQL_HOST=db
- MYSQL_USER_PASSWD=db_pass
- MYSQL_ROOT_PASSWD=db_pass
volumes:
- media:/shared/media
- ./seafile/conf:/shared/conf
- ./seafile/logs:/shared/logs
- /mnt/back/seafile-data:/shared/seafile-data
- ./seafile/seahub-data:/shared/seahub-data
depends_on:
- db
db:
image: linuxserver/mariadb
restart: always
environment:
- PUID=1000
- PGID=1000
- MYSQL_ROOT_PASSWORD=db_pass
- TZ=Europe/Berlin
volumes:
- ./db:/config
# reverse-proxy:
# image: linuxserver/swag
# restart: always
# cap_add:
# - NET_ADMIN
# environment:
# - PUID=1000
# - PGID=1000
# - TZ=Europe/Berlin
# - URL=my.domain
# - VALIDATION=http
# volumes:
# - media:/shared/media
# - ./seafile/seahub-data:/shared/seahub-data
# - ./reverse-proxy:/config
# ports:
# - 443:443
# - 80:80
volumes:
media:
d. My complete Caddyfile or JSON config:
my.domain {
reverse_proxy 127.0.0.1:8000
}
my.domain/seafhttp {
reverse_proxy 127.0.0.1:8082
}
my.domain/media {
root * /shared/media
file_server
}
3. The problem I’m having:
GET / HTTP/1.1
> Host: my.domain
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 308 Permanent Redirect
< Connection: close
< Location: https://my.domain/
< Server: Caddy
< Date: Fri, 07 Jan 2022 21:16:07 GMT
< Content-Length: 0
<
* Closing connection 0
Okay, what am I doing here, well first. Caddy is my favorite Proxy, but this Seafile-ARM compose file I am using the last months uses SWAG/Ngnix. So I try to put the SWAG Container down (it doesn`t run, I marked it out and did a docker-compose down and up -d). And installed Caddy through the repo.
My Caddyfile gave me a working SSL Cert. and I can see it in my browser, but the page is blank. Seafile isn`t running, and I think my error here is the way I try to include the file_server at the end.
here is the old swag conf, which runs good, but I dont find a solution to migrate it correctly to caddy.
server {
listen 80;
server_name my.domain;
rewrite ^ https://$http_host$request_uri? permanent;
server_tokens off;
}
server {
listen 443;
server_name my.domain;
# all ssl related config moved to ssl.conf
include /config/nginx/ssl.conf;
server_tokens off;
location / {
proxy_pass http://seafile:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto https;
proxy_read_timeout 1200s;
client_max_body_size 0;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ $1 break;
proxy_pass http://seafile:8082;
client_max_body_size 0;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
proxy_send_timeout 36000s;
send_timeout 36000s;
}
location /media {
root /shared;
}
}
I struggle with these paths from system to container and from container to system, and I should be grateful that everything works with swag, but I really want it to run with caddy, because I run all my servers with it, and if it works, it will be easier for me to combine it with other services running on my network.
I tried some combinations with this line from the compose file in caddy to get the fileserver part: - /mnt/back/seafile-data:/shared/seafile-data because /mnt/back is a physical storage, connected via USB and stores all the files (seafile-data).
file_server /mnt/back/seafile-data for example.
tl:dr
The cert goes to the domain, and caddy looks like it works well. but there are some missing parts for the file_server.
I bet it is simple, but I dont see it. Thx for helping me out with this.