- Data fetched from Open5e API: 3,215 items (339 spells, 330 creatures, 24 classes, 2,319 magic items, 203 equipment) - FastAPI app with API key auth (X-API-Key header or ?api_key= param) - Sliding window rate limiting (60 req/min, 10K req/day) - Dice rolling endpoint (e.g., /api/dice/roll?spec=2d20+5) - Full-text search across all resource types - Pagination, filtering (name, level, school, class, etc.) - Admin CLI for API key management - nginx + systemd service ready for deployment
44 lines
No EOL
1.5 KiB
Nginx Configuration File
44 lines
No EOL
1.5 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name dnd.jezzahehn.com;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name dnd.jezzahehn.com;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/dnd.jezzahehn.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/dnd.jezzahehn.com/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
|
|
|
# Security headers
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "DENY" always;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8000;
|
|
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;
|
|
|
|
# Long timeout for large responses
|
|
proxy_read_timeout 30s;
|
|
proxy_send_timeout 30s;
|
|
|
|
# Increase buffer for API responses
|
|
proxy_buffers 8 64k;
|
|
proxy_buffer_size 64k;
|
|
}
|
|
|
|
# Deny access to sensitive files
|
|
location ~ /\.git {
|
|
deny all;
|
|
}
|
|
|
|
access_log /var/log/nginx/dnd-api-access.log;
|
|
error_log /var/log/nginx/dnd-api-error.log;
|
|
} |