add dockercompose and nginx.conf
This commit is contained in:
1 parent
5baf284b7c
commit
4b6b42947a
2 files changed
+38
No files matched your search
@@ -0,0 +1,28 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
volumes:
|
||||||
|
- media_volume:/app/media:rw # جنگو باید بتواند فایل بنویسد
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.django-router.rule=Host(`apibashgah.loolegostar.com`) && !PathPrefix(`/media/`)"
|
||||||
|
- "traefik.http.services.django-service.loadbalancer.server.port=8000"
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
image: nginx:alpine
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
- media_volume:/app/media:ro # انجینکس فقط باید بخواند (امنتر)
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.nginx-router.rule=Host(`apibashgah.loolegostar.com`) && PathPrefix(`/media/`)"
|
||||||
|
- "traefik.http.services.nginx-service.loadbalancer.server.port=80"
|
||||||
|
depends_on:
|
||||||
|
- web
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
media_volume:
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name apibashgah.loolegostar.com;
|
||||||
|
|
||||||
|
location /media/ {
|
||||||
|
alias /app/media/;
|
||||||
|
expires 30d;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user