This commit is contained in:
3
nginx/Dockerfile
Normal file
3
nginx/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# FROM nginx:latest
|
||||||
|
# # Копируем твой конфиг прямо в папку конфигураций nginx внутри образа
|
||||||
|
# COPY default.conf /etc/nginx/conf.d/default.conf
|
||||||
35
nginx/default.conf
Normal file
35
nginx/default.conf
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
upstream django_app {
|
||||||
|
server web:8000;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost; # Можешь заменить на свой IP или домен
|
||||||
|
|
||||||
|
# Максимальный размер загружаемого файла (важно для чертежей/моделей)
|
||||||
|
client_max_body_size 100M;
|
||||||
|
|
||||||
|
# Основной прокси на Django
|
||||||
|
location / {
|
||||||
|
proxy_pass http://django_app;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_redirect off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Статические файлы (STATIC_ROOT в Django)
|
||||||
|
location /static/ {
|
||||||
|
alias /app/staticfiles/;
|
||||||
|
expires 30d;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Медиа файлы (MEDIA_ROOT в Django)
|
||||||
|
location /media/ {
|
||||||
|
alias /app/media/;
|
||||||
|
expires 30d;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user