51 lines
1.6 KiB
Text
51 lines
1.6 KiB
Text
# Nginx configuration for api.mnemo-cards.online
|
|
# Generated by generate-nginx-configs.sh on Thu Nov 27 22:57:44 MSK 2025
|
|
# Service: api
|
|
|
|
server {
|
|
listen 80;
|
|
server_name api.mnemo-cards.online;
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name api.mnemo-cards.online;
|
|
|
|
# SSL configuration
|
|
ssl_certificate /etc/letsencrypt/live/mnemo-cards.online/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/mnemo-cards.online/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
# Security headers
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
|
|
# API Backend specific settings
|
|
client_max_body_size 100M;
|
|
|
|
# CORS headers are handled by the backend server, nginx only proxies
|
|
|
|
# Proxy to backend server (HTTPS for API - backend runs with SSL)
|
|
location / {
|
|
proxy_pass https://127.0.0.1:8081;
|
|
proxy_ssl_verify off; # Skip SSL verification for local connection
|
|
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_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
|
|
# Security - deny access to hidden files
|
|
location ~ /\. {
|
|
deny all;
|
|
}
|
|
}
|