137 lines
4.4 KiB
Plaintext
137 lines
4.4 KiB
Plaintext
# =============================================================================
|
|
# Nginx Configuration for Gitgram + AITimeMachine
|
|
# Behind Cloudflare Free Tier (Full Strict SSL)
|
|
# =============================================================================
|
|
|
|
# Cloudflare IP ranges for real IP restoration
|
|
set_real_ip_from 173.245.48.0/20;
|
|
set_real_ip_from 103.21.244.0/22;
|
|
set_real_ip_from 103.22.200.0/22;
|
|
set_real_ip_from 103.31.4.0/22;
|
|
set_real_ip_from 141.101.64.0/18;
|
|
set_real_ip_from 108.162.192.0/18;
|
|
set_real_ip_from 190.93.240.0/20;
|
|
set_real_ip_from 188.114.96.0/20;
|
|
set_real_ip_from 197.234.240.0/22;
|
|
set_real_ip_from 198.41.128.0/17;
|
|
set_real_ip_from 162.158.0.0/15;
|
|
set_real_ip_from 104.16.0.0/13;
|
|
set_real_ip_from 104.24.0.0/14;
|
|
set_real_ip_from 172.64.0.0/13;
|
|
set_real_ip_from 131.0.72.0/22;
|
|
# IPv6
|
|
set_real_ip_from 2400:cb00::/32;
|
|
set_real_ip_from 2606:4700::/32;
|
|
set_real_ip_from 2803:f800::/32;
|
|
set_real_ip_from 2405:b500::/32;
|
|
set_real_ip_from 2405:8100::/32;
|
|
set_real_ip_from 2a06:98c0::/29;
|
|
set_real_ip_from 2c0f:f248::/32;
|
|
real_ip_header CF-Connecting-IP;
|
|
|
|
# HTTP -> HTTPS redirect
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name gitgram.app www.gitgram.app timemachine.gitgram.app timemachine-api.gitgram.app;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
# =============================================================================
|
|
# gitgram.app — Gitgram Web + Backend
|
|
# =============================================================================
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name gitgram.app www.gitgram.app;
|
|
|
|
# Cloudflare Origin Certificate
|
|
ssl_certificate /etc/ssl/cloudflare/gitgram.app.pem;
|
|
ssl_certificate_key /etc/ssl/cloudflare/gitgram.app.key;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
# Proxy headers
|
|
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;
|
|
|
|
# API routes -> Gitgram Backend (port 4000)
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:4000;
|
|
proxy_http_version 1.1;
|
|
|
|
# File uploads
|
|
client_max_body_size 100M;
|
|
}
|
|
|
|
# WebSocket (Socket.IO) -> Gitgram Backend
|
|
location /socket.io/ {
|
|
proxy_pass http://127.0.0.1:4000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_read_timeout 86400s;
|
|
proxy_send_timeout 86400s;
|
|
}
|
|
|
|
# Everything else -> Gitgram Web (port 3000)
|
|
location / {
|
|
proxy_pass http://127.0.0.1:3000;
|
|
proxy_http_version 1.1;
|
|
}
|
|
}
|
|
|
|
# =============================================================================
|
|
# timemachine.gitgram.app — AITM Website
|
|
# =============================================================================
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name timemachine.gitgram.app;
|
|
|
|
# Cloudflare Origin Certificate (reuses gitgram.app wildcard)
|
|
ssl_certificate /etc/ssl/cloudflare/gitgram.app.pem;
|
|
ssl_certificate_key /etc/ssl/cloudflare/gitgram.app.key;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
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;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:3002;
|
|
proxy_http_version 1.1;
|
|
}
|
|
}
|
|
|
|
# =============================================================================
|
|
# timemachine-api.gitgram.app — AITM API Server
|
|
# =============================================================================
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name timemachine-api.gitgram.app;
|
|
|
|
# Cloudflare Origin Certificate (reuses gitgram.app wildcard)
|
|
ssl_certificate /etc/ssl/cloudflare/gitgram.app.pem;
|
|
ssl_certificate_key /etc/ssl/cloudflare/gitgram.app.key;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
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;
|
|
|
|
client_max_body_size 50M;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:3001;
|
|
proxy_http_version 1.1;
|
|
}
|
|
}
|