mirror of
https://github.com/thecyberlearn/modern-django-starter.git
synced 2026-08-18 18:12:54 +00:00
✨ Features: - Complete Django project with authentication - Email/password and social login (Google, Facebook) - Role-based access control (admin, staff, user) - Docker and Docker Compose setup - Production-ready configuration - Static file handling with WhiteNoise - PostgreSQL database integration - Comprehensive documentation - GitHub CI/CD workflows - Dokploy deployment configuration 🚀 Ready for deployment on Dokploy, Heroku, Railway, and other platforms
51 lines
1.5 KiB
Plaintext
51 lines
1.5 KiB
Plaintext
upstream django {
|
|
server web:8000;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name your-domain.com www.your-domain.com;
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name your-domain.com www.your-domain.com;
|
|
|
|
# SSL Configuration
|
|
ssl_certificate /etc/nginx/ssl/cert.pem;
|
|
ssl_certificate_key /etc/nginx/ssl/key.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384;
|
|
ssl_prefer_server_ciphers off;
|
|
ssl_session_cache shared:SSL:10m;
|
|
|
|
# Security headers
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
|
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
|
|
|
|
location / {
|
|
proxy_pass http://django;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $host;
|
|
proxy_redirect off;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
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";
|
|
}
|
|
|
|
client_max_body_size 20M;
|
|
} |