fix nginx media serve

This commit is contained in:
godd0t 2023-05-10 15:26:50 +02:00
parent 4456137954
commit abd389b04c
2 changed files with 7 additions and 8 deletions

View File

@ -6,11 +6,13 @@ http {
server {
listen 80;
location /static/ {
location /static {
autoindex on;
alias /usr/src/app/static/;
}
location /media/ {
location /media {
autoindex on;
alias /usr/src/app/media/;
}
}

View File

@ -76,12 +76,9 @@ services:
- media_files:/usr/src/app/media
labels:
- "traefik.enable=true"
- "traefik.http.routers.${APP_NAME}-nginx-static.rule=Host(`${APP_HOST}`) && PathPrefix(`/static`)"
- "traefik.http.routers.${APP_NAME}-nginx-media.rule=Host(`${APP_HOST}`) && PathPrefix(`/media`)"
- "traefik.http.routers.${APP_NAME}-nginx-static.entrypoints=web"
- "traefik.http.routers.${APP_NAME}-nginx-media.entrypoints=web"
- "traefik.http.services.${APP_NAME}-nginx-static.loadbalancer.server.port=80"
- "traefik.http.services.${APP_NAME}-nginx-media.loadbalancer.server.port=80"
- "traefik.http.routers.${APP_NAME}-nginx.rule=Host(`${APP_HOST}`) && (PathPrefix(`/static`) || PathPrefix(`/media`))"
- "traefik.http.routers.${APP_NAME}-nginx.entrypoints=web"
- "traefik.http.services.${APP_NAME}-nginx.loadbalancer.server.port=80"
depends_on:
- backend