mirror of
https://github.com/thecyberlearn/quantumtaskai-caprover.git
synced 2026-08-18 09:52:57 +00:00
- Add docker-compose.yml for Dokploy deployment - Add Dockerfile optimized for production - Add nginx.conf for SSL and reverse proxy - Update Django settings for ai.quantumtaskai.com domain - Add Neon database configuration - Add deployment guides and environment generators - Remove CapRover specific files
129 lines
3.8 KiB
Nginx Configuration File
129 lines
3.8 KiB
Nginx Configuration File
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
upstream web {
|
|
server web:8000;
|
|
}
|
|
|
|
# Rate limiting
|
|
limit_req_zone $binary_remote_addr zone=web:10m rate=10r/s;
|
|
limit_req_zone $binary_remote_addr zone=api:10m rate=30r/s;
|
|
|
|
# MIME types
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
# Security headers
|
|
add_header X-Frame-Options DENY always;
|
|
add_header X-Content-Type-Options nosniff always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
|
|
|
|
# Logging
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
|
|
access_log /var/log/nginx/access.log main;
|
|
error_log /var/log/nginx/error.log warn;
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_proxied any;
|
|
gzip_comp_level 6;
|
|
gzip_types
|
|
text/plain
|
|
text/css
|
|
text/xml
|
|
text/javascript
|
|
application/json
|
|
application/javascript
|
|
application/xml+rss
|
|
application/atom+xml;
|
|
|
|
# HTTP to HTTPS redirect
|
|
server {
|
|
listen 80;
|
|
server_name ai.quantumtaskai.com;
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
|
|
# HTTPS server
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name ai.quantumtaskai.com;
|
|
|
|
# SSL configuration
|
|
ssl_certificate /etc/letsencrypt/live/ai.quantumtaskai.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/ai.quantumtaskai.com/privkey.pem;
|
|
|
|
# SSL security settings
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384;
|
|
ssl_prefer_server_ciphers off;
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 10m;
|
|
|
|
# Security headers specific to HTTPS
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
|
|
|
|
# Client max body size
|
|
client_max_body_size 100M;
|
|
|
|
# Static files
|
|
location /static/ {
|
|
alias /var/www/static/;
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Media files
|
|
location /media/ {
|
|
alias /var/www/media/;
|
|
expires 1y;
|
|
add_header Cache-Control "public";
|
|
}
|
|
|
|
# API endpoints with higher rate limit
|
|
location /api/ {
|
|
limit_req zone=api burst=10 nodelay;
|
|
proxy_pass http://web;
|
|
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;
|
|
}
|
|
|
|
# Health check endpoint
|
|
location /health/ {
|
|
proxy_pass http://web;
|
|
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;
|
|
access_log off;
|
|
}
|
|
|
|
# Main application
|
|
location / {
|
|
limit_req zone=web burst=5 nodelay;
|
|
proxy_pass http://web;
|
|
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;
|
|
|
|
# Timeouts
|
|
proxy_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
}
|
|
}
|