forked from Nova-reward/Nova-Rewards
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
89 lines (76 loc) · 2.66 KB
/
Copy pathnginx.conf
File metadata and controls
89 lines (76 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# NGINX Configuration for Nova Rewards with SSL/TLS
# This configuration handles HTTPS-only traffic with automatic redirects
# and implements HSTS for enhanced security.
# Upstream backend service
upstream nova_backend {
server backend:4000;
keepalive 32;
}
# Redirect HTTP to HTTPS (301 permanent redirect)
server {
listen 80;
listen [::]:80;
server_name api.nova-rewards.xyz;
# Allow Let's Encrypt ACME challenges
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
# Redirect all other traffic to HTTPS
location / {
return 301 https://$server_name$request_uri;
}
}
# HTTPS server block
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name api.nova-rewards.xyz;
# SSL Certificate paths (managed by Certbot)
ssl_certificate /etc/letsencrypt/live/api.nova-rewards.xyz/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.nova-rewards.xyz/privkey.pem;
# SSL Configuration - Modern TLS 1.2+
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# HSTS (Strict-Transport-Security) - 1 year with subdomains
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Additional security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# Logging
access_log /var/log/nginx/nova_access.log;
error_log /var/log/nginx/nova_error.log;
# Health check endpoint
location /health {
proxy_pass http://nova_backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
access_log off;
}
# API routes
location /api/ {
proxy_pass http://nova_backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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_buffering off;
proxy_request_buffering off;
}
# Root path
location / {
proxy_pass http://nova_backend;
proxy_http_version 1.1;
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;
}
}