first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 22:22:29 +03:00
commit ec28a2024d
208 changed files with 23836 additions and 0 deletions

21
nginx/Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
# Nginx alpine base image
FROM nginx:alpine
# Remove default nginx config
RUN rm /etc/nginx/conf.d/default.conf
# Copy our custom nginx config
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
# Create directories for static and media files
RUN mkdir -p /app/staticfiles /app/media
# Expose port 80
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost/ || exit 1
# Start nginx
CMD ["nginx", "-g", "daemon off;"]

38
nginx/default.conf Normal file
View File

@@ -0,0 +1,38 @@
upstream django_backend {
server django_web_prod:8000 max_fails=3 fail_timeout=30s;
server web:8000 backup;
}
server {
listen 80;
server_name _;
client_max_body_size 100M;
location / {
proxy_pass http://django_backend;
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;
# Connection settings
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
location /static/ {
alias /app/staticfiles/;
expires 30d;
add_header Cache-Control "public, immutable";
}
location /media/ {
alias /app/media/;
expires 7d;
add_header Cache-Control "public";
}
}