Hello everyone, I have decided to use Traefik because using nginx reverse proxy gave me problems. I don't know much about Traefik, but I have tried to make a private cloud for remote access using Nextcloud. The problem is that I get the following error with Nextcloud: Gateway Timeout. But when I want to access to Nginx web server it works fine.
The IPs of my containers in the traefik docker networks are:
traefik: 172.28.0.2
nextcloud: 172.28.0.3
I also used Duckdns for the domain names.
This is the steps and configuration i took:
-
I open the port 80 and 443 ports in my router.
-
traefik:
2.1 Executed my traefik docker compose file:
version: '3'
networks:
traefik:
external: true
services:
traefik:
restart: always
image: "traefik:latest"
container_name: "traefik"
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- /traefik/etc:/etc/traefik
- /traefik/certs:/etc/traefik/certs/
- /traefik/logs:/var/log/traefik
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- traefik
2.2 With my configuration file
global:
checkNewVersion: true
sendAnonymousUsage: false
log:
level: ERROR
format: common
filePath: /var/log/traefik/traefik.log
accesslog:
format: common
filePath: /var/log/traefik/access.log
api:
dashboard: true
insecure: true
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: :443
certificatesResolvers:
staging:
acme:
email: rmendezh@ies-sabadell.cat
storage: /etc/traefik/certs/acme.json
caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"
httpChallenge:
entryPoint: web
production:
acme:
email: rmendezh@ies-sabadell.cat
storage: /etc/traefik/certs/acme.json
caServer: "https://acme-v02.api.letsencrypt.org/directory"
httpChallenge:
entryPoint: web
providers:
docker:
exposedByDefault: false
file:
directory: /etc/traefik
watch: true
- My compsoe file for nextcloud
version: '3.2'
networks:
traefik:
external: true
backend:
external: true
services:
db:
image: mariadb:10.5
restart: always
container_name: db
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- /nextcloud/database:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=*******
- MYSQL_PASSWORD=*******
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
networks:
- backend
nextcloud:
container_name: nextcloud
networks:
- traefik
- backend
depends_on:
- db
ports:
- 8282:80
image: nextcloud:apache
restart: always
volumes:
- /nextcloud/html:/var/www/html
- /nextcloud/logs:/var/log
environment:
- MYSQL_PASSWORD=*******
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
labels:
- "traefik.enable=true"
- "traefik.http.routers.nextcloud.entrypoints=web, websecure"
- "traefik.http.routers.nextcloud.rule=Host(`my.domain.com`)"
- "traefik.http.routers.nextcloud.tls=true"
- "traefik.http.routers.nextcloud.tls.certresolver=production"
- I edited the config.php file in Nextcloud. I addded:
'trusted_domains' =>
array (
0 => '192.168.1.13:8282',
1 => 'my.domain.org',
),
'trusted_proxies' =>
array (
0 => '172.28.0.2',
),
Screenshot from the service of traefik: