I'm sorry for posting it here, I'm sure it's not an issue but I'm doing something wrong but I'm quite desperate.
I have a django app and want to load static files by nginx. But somehow the routing refuses to go to nginx for anything. nginx shows 0 logs of activity, as if traefik is not talking to that service.
Here's my code:
web-nginx.yml:
services:
web:
#build: ./web
image: web:production
command: gunicorn web.wsgi:application --bind 0.0.0.0:8000
volumes:
- static_volume:/usr/src/app/static
ports:
- "8000:8000"
networks:
- traefik-public
env_file:
- .env
#depends_on:
# - migration_and_static
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.web.rule=Host(`example`)"
- "traefik.http.routers.web.entrypoints=websecure"
- "traefik.http.routers.static.priority=1"
- "traefik.http.routers.web.tls.certresolver=letsencryptresolver"
- "traefik.http.services.web.loadbalancer.server.port=8000"
update_config:
delay: 10s
static:
image: nginx
volumes:
- static_volume:/usr/share/nginx/html:ro
networks:
- traefik-public
labels:
- "traefik.enable=true"
- "traefik.http.routers.static.rule=Host(`example.com`) && PathPrefix(`/static`)"
- "traefik.http.routers.static.entrypoints=websecure"
- "traefik.http.routers.static.service=static"
- "traefik.http.routers.static.priority=200"
- "traefik.http.routers.static.tls.certresolver=letsencryptresolver"
- "traefik.http.services.static.loadbalancer.server.port=8080"
- "traefik.http.middlewares.static-stripprefix.stripprefix.prefixes=/static"
# Match on the hostname and the path
# - traefik.enable=true
# - traefik.http.routers.static.rule=(Host(`example.com`) && Path(`/static`))
# - traefik.http.routers.static.tls=true
# - traefik.http.routers.static.tls.certresolver=le
# - traefik.http.services.static.loadbalancer.server.port=80
# # Define a new middleware to strip the URL prefix before sending it to static-files
# - traefik.http.middlewares.static-stripprefix.stripprefix.prefixes=/static
# tell Traefik which middlewares we want to use on this container
# - traefik.http.routers.static.middlewares=gzip@docker,static-stripprefix@docker
#depends_on:
# - web
volumes:
static_volume:
networks:
traefik-public:
external: true
I'm sorry for posting it here, I'm sure it's not an issue but I'm doing something wrong but I'm quite desperate.
I have a django app and want to load static files by nginx. But somehow the routing refuses to go to nginx for anything. nginx shows 0 logs of activity, as if traefik is not talking to that service.
Here's my code:
web-nginx.yml:
traefik.yml:
Sorry once again, don't know where else to go
Thanks! Sam