-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathdefault-https.conf
More file actions
35 lines (29 loc) · 1.02 KB
/
default-https.conf
File metadata and controls
35 lines (29 loc) · 1.02 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
upstream backend_ai {
server backend:8000;
}
server {
listen 80;
server_name test.serenus.one;
# Redirect HTTP to HTTPS
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2; # Enable HTTP/2 for better performance
server_name test.serenus.one;
# SSL settings provided by Certbot
ssl_certificate /etc/letsencrypt/live/test.serenus.one/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/test.serenus.one/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
# Add HSTS header for additional security (enforces HTTPS)
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
location / {
proxy_pass http://backend_ai;
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;
}
}