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
|
upstream siyuan {
server 127.0.0.1:6806; # 将流量定向到本地的6806端口
}
server {
listen 80;
listen [::]:80;
server_name your_domain.com; # 设置服务器域名
# 将所有 HTTP 请求重定向到 HTTPS
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name your_domain.com; # 设置服务器域名
# 配置 SSL 证书路径
ssl_certificate path/fullchain.cer;
ssl_certificate_key path/file.key;
client_max_body_size 0; # 不限制请求体大小
location / {
proxy_pass http://siyuan; # 反向代理到上游 siyuan
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /ws {
proxy_pass http://siyuan;
proxy_read_timeout 60s; # 设置读取超时时间
proxy_http_version 1.1; # 使用 HTTP 1.1
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'Upgrade'; # 支持 WebSocket
}
}
|