fix nginx media serve

This commit is contained in:
godd0t 2023-05-10 15:53:47 +02:00
parent 459fe09307
commit 32276412fc
2 changed files with 11 additions and 3 deletions

View File

@ -8,9 +8,14 @@ http {
server {
listen 80;
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
location /static {
autoindex on;
alias /usr/src/app/;
alias /usr/src/app/static/;
}
location /media {
autoindex on;
alias /usr/src/app/media/;
}
}
}

View File

@ -76,7 +76,7 @@ services:
- media_files:/usr/src/app/media
labels:
- "traefik.enable=true"
- "traefik.http.routers.${APP_NAME}-nginx.rule=Host(`${APP_HOST}`) && (PathPrefix(`/static`) && PathPrefix(`/media`))"
- "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:
@ -90,6 +90,9 @@ services:
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.web-secure.address=:443"
- "--log.level=DEBUG"
- "--log.format=json"
- "--log.filePath=/logs/traefik.log"
- "--accesslog=true"
- "--accesslog.filePath=/logs/access.log"
- "--certificatesresolvers.letsencrypt.acme.email=${LETSENCRYPT_EMAIL}"