Dear all,
I am having problems when trying to install Nextcloud on my home server using Podman containers and running everything behind a caddy reverse proxy container.
I am able to install Nextcloud but have two issues which I am not able to solve.
- I can not open Office documents, because Nextcloud is unable to open the document with the integrated Code server, which is installed. As far as I understand it, this is caused by the fact that the Nextcloud container is running behind a reverse proxy and somehow can not connect to the integrated Code server.
- I am unable to login into the Nextcloud instance via the Nextcloud Desktop client because the returned server url does not seam to start with https. This is probably also caused from set up where the reverse proxy send the traffic via http to the Nextcloud container.
I already asked ChatGPT and Google Gemini and tried every approach I found online, but somehow I can not get it to work.
My reverse proxy is set up the following way:
[Container]
ContainerName=caddy-reverse-proxy
Image=docker.io/library/caddy:latest
AutoUpdate=registry
PublishPort=80:80
PublishPort=443:443
Volume=/mnt/storage/reverse-proxy/Caddyfile:/etc/caddy/Caddyfile:z
Volume=/mnt/storage/reverse-proxy/data:/data:z
Network=host
[Service]
Restart=always
[Install]
WantedBy=default.target
{
email my-address@proton.me
}
nextcloud.my.domain {
reverse_proxy 127.0.0.1:8080
}
The Nextcloud container setup is the following way:
[Pod]
PodName=nextcloud
PublishPort=8080:80
[Service]
Restart=always
[Install]
WantedBy=default.target
[Container]
ContainerName=mariadb-nextcloud
Pod=nextcloud.pod
Image=docker.io/library/mariadb:latest
AutoUpdate=registry
Volume=/mnt/storage/nextcloud/mariadb:/var/lib/mysql:z
Environment=MYSQL_DATABASE=nextcloud
Environment=MYSQL_USER=USERNAME
Environment=MYSQL_PASSWORD=PASSWORD
Environment=MYSQL_ROOT_PASSWORD=PASSWORD
Exec=--transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW --max_allowed_packet=256000000
[Unit]
After=nextcloud.pod
Requires=nextcloud.pod
[Service]
Restart=always
[Install]
WantedBy=default.target
[Container]
ContainerName=caddy-nextcloud
Pod=nextcloud.pod
Image=docker.io/library/caddy:latest
AutoUpdate=registry
Volume=/mnt/storage/nextcloud/nextcloud:/var/www/html:z
Volume=/mnt/storage/nextcloud/caddy/Caddyfile:/etc/caddy/Caddyfile:z
[Unit]
After=nextcloud.pod
After=mariadb-nextcloud.container
After=nextcloud-app.container
Requires=nextcloud.pod
Requires=mariadb-nextcloud.container
Requires=nextcloud-app.container
[Service]
Restart=always
[Install]
WantedBy=default.target
[Container]
ContainerName=nextcloud-app
Pod=nextcloud.pod
Image=docker.io/library/nextcloud:fpm
AutoUpdate=registry
Environment=MYSQL_DATABASE=nextcloud
Environment=MYSQL_USER=USERNAME
Environment=MYSQL_PASSWORD=PASSWORD
Environment=MYSQL_HOST=nextcloud
Volume=/mnt/storage/nextcloud/nextcloud:/var/www/html:z
Volume=/mnt/storage/nextcloud/data:/var/www/html/data:z
[Unit]
After=nextcloud.pod
After=mariadb-nextcloud.container
Requires=nextcloud.pod
Requires=mariadb-nextcloud.container
[Service]
Restart=always
[Install]
WantedBy=default.target
:80 {
root * /var/www/html
file_server
php_fastcgi nextcloud-app:9000 {
root /var/www/html
env front_controller_active true
}
encode gzip
log {
output file /data/nextcloud-access.log
}
header {
Strict-Transport-Security "max-age=15768000;includeSubDomains;preload"
}
# .htaccess / data / config / ... shouldn't be accessible from outside
@forbidden {
path /.htaccess
path /data/*
path /config/*
path /db_structure
path /.xml
path /README
path /3rdparty/*
path /lib/*
path /templates/*
path /occ
path /console.php
}
respond @forbidden 404
redir /.well-known/carddav /remote.php/dav 301
redir /.well-known/caldav /remote.php/dav 301
}
It would be great if someone has an idea, how my two problems can be addressed, but Nextcloud is such a cool project and it would like to use it more.
Best regards,
Phillip
