-
Notifications
You must be signed in to change notification settings - Fork 5
/
nginx.conf
71 lines (60 loc) · 2.35 KB
/
nginx.conf
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
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
client_max_body_size 10M;
types {
application/javascript js;
}
error_page 404 =301 https://chat.vlist.cc;
server {
listen 80;
server_name chat.vlist.cc;
# 重定向所有 HTTP 请求到 HTTPS
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name chat.vlist.cc;
# SSL 证书和私钥的位置(根据您的实际路径替换)
ssl_certificate chat.vlist.cc_bundle.crt;
ssl_certificate_key chat.vlist.cc.key;
# SSL 配置(根据需要调整)
ssl_session_timeout 5m;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location ~* \.js$ {
add_header Content-Type application/javescript;
}
location /api/v1 {
proxy_pass http://chatflow-admin.com:9503; # 使用域名同时在Nginx配置中添加hosts
}
location / {
root html;
index index.html index.htm;
# CORS 配置
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
}
}
}
}