89 lines
2.6 KiB
Plaintext
89 lines
2.6 KiB
Plaintext
# sojorn.net - Pure redirect to mp.ls
|
|
server {
|
|
server_name sojorn.net www.sojorn.net;
|
|
|
|
location = /terms {
|
|
return 301 https://mp.ls/terms;
|
|
}
|
|
location = /privacy {
|
|
return 301 https://mp.ls/privacy;
|
|
}
|
|
location / {
|
|
return 301 https://mp.ls/sojorn;
|
|
}
|
|
|
|
listen 443 ssl;
|
|
ssl_certificate /etc/letsencrypt/live/sojorn.net/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/sojorn.net/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
}
|
|
|
|
# api.sojorn.net - Backend
|
|
server {
|
|
server_name api.sojorn.net;
|
|
client_max_body_size 100M;
|
|
|
|
# Auth endpoints - strict rate limit (5 req/min)
|
|
location ~ ^/api/v1/(auth|login|register|verify|refresh) {
|
|
limit_req zone=auth burst=3 nodelay;
|
|
proxy_pass http://localhost:8080;
|
|
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;
|
|
}
|
|
|
|
# Upload endpoints - moderate rate limit (10 req/min)
|
|
location ~ ^/api/v1/(media|upload) {
|
|
limit_req zone=upload burst=5 nodelay;
|
|
proxy_pass http://localhost:8080;
|
|
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;
|
|
}
|
|
|
|
# All other API endpoints - general rate limit (30 req/s)
|
|
location / {
|
|
limit_req zone=api burst=50 nodelay;
|
|
proxy_pass http://localhost:8080;
|
|
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;
|
|
|
|
# WebSocket support
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
|
|
listen 443 ssl;
|
|
ssl_certificate /etc/letsencrypt/live/sojorn.net/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/sojorn.net/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
}
|
|
|
|
server {
|
|
if ($host = www.sojorn.net) {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
if ($host = sojorn.net) {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
server_name sojorn.net www.sojorn.net;
|
|
listen 80;
|
|
return 404;
|
|
}
|
|
|
|
server {
|
|
if ($host = api.sojorn.net) {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
server_name api.sojorn.net;
|
|
listen 80;
|
|
return 404;
|
|
}
|