forked from KiWi233333/JiwuChat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
99 lines (85 loc) · 3.56 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
server {
listen 80;
listen 443 ssl;
listen 443 quic;
http2 on;
server_name jiwu.kiwi2333.top;
index index.html index.htm default.htm default.html;
#root /www/wwwroot/jiwuquan/front-jiwuquan-pc; # http2
# 开启http3
#CERT-APPLY-CHECK--START
# 用于SSL证书申请时的文件验证相关配置 -- 请勿删除
include /www/server/panel/vhost/nginx/well-known/front_jiwuquan_pc.conf;
#CERT-APPLY-CHECK--END
#SSL-START SSL相关配置
#error_page 404/404.html;
#HTTP_TO_HTTPS_START
if ($server_port !~ 443) {
rewrite ^(/.*)$ https://$host$1 permanent;
}
#HTTP_TO_HTTPS_END
ssl_certificate /www/server/panel/vhost/cert/front_jiwuquan_pc/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/front_jiwuquan_pc/privkey.pem;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000";
add_header Alt-Svc 'quic=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"';
error_page 497 https://$host$request_uri;
#SSL-END
#ERROR-PAGE-START 错误页相关配置
#error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
#REWRITE-START 伪静态相关配置
include /www/server/panel/vhost/rewrite/node_front_jiwuquan_pc.conf;
#REWRITE-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md|package.json|package-lock.json|\.env) {
return 404;
}
#一键申请SSL证书验证目录相关设置
location /.well-known/ {
root /www/wwwroot/jiwuquan/front-jiwuquan-pc;
}
#禁止在证书验证目录放入敏感文件
if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
return 403;
}
# HTTP反向代理相关配置开始 >>>
location ~ /purge(/.*) {
proxy_cache_purge cache_one $host$request_uri$is_args$args;
}
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Host $host:$server_port;
proxy_set_header X-Scheme $scheme;
proxy_read_timeout 86400s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /font {
proxy_pass http://127.0.0.1:3000/font;
# 允许所有域名的跨域请求
add_header 'Access-Control-Allow-Origin' '*';
# 允许的 HTTP 方法
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;
# 预检请求的响应
if ($request_method = 'OPTIONS') {
return 204;
}
}
# HTTP反向代理相关配置结束 <<<
access_log /www/wwwlogs/front_jiwuquan_pc.log;
error_log /www/wwwlogs/front_jiwuquan_pc.error.log;
}