-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnginx.conf
More file actions
56 lines (46 loc) · 1.52 KB
/
nginx.conf
File metadata and controls
56 lines (46 loc) · 1.52 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
events {
worker_connections 1024;
}
http {
upstream spring-app {
server app:8080;
}
# HTTP server - redirect to HTTPS
server {
listen 80;
server_name api-v1.waggle.store;
# Health check endpoint (HTTP only)
location /health {
access_log off;
return 200 "OK";
add_header Content-Type text/plain;
}
# Redirect all other HTTP traffic to HTTPS
location / {
return 301 https://$server_name$request_uri;
}
}
# HTTPS server
server {
listen 443 ssl;
server_name api-v1.waggle.store;
ssl_certificate /etc/letsencrypt/live/api-v1.waggle.store/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api-v1.waggle.store/privkey.pem;
# SSL settings
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384;
client_max_body_size 10M;
location / {
proxy_pass http://spring-app;
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";
}
}
}