ZSCGR commited on
Commit
5a8519a
·
verified ·
1 Parent(s): 3f65ed4

Update nginx.conf

Browse files
Files changed (1) hide show
  1. nginx.conf +55 -5
nginx.conf CHANGED
@@ -1,10 +1,60 @@
1
- server {
2
- listen 4444 default_server;
3
- listen [::]:4444 default_server;
4
 
5
- server_name _;
 
6
 
7
- error_log /dev/null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  location / {
10
  proxy_pass http://localhost:3000;
 
1
+ worker_processes auto;
 
 
2
 
3
+ error_log /var/log/nginx/error.log warn;
4
+ pid /var/run/nginx.pid;
5
 
6
+ events {
7
+ worker_connections 1024;
8
+ }
9
+
10
+ http {
11
+ include /etc/nginx/mime.types;
12
+ default_type application/octet-stream;
13
+
14
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
15
+ '$status $body_bytes_sent "$http_referer" '
16
+ '"$http_user_agent" "$http_x_forwarded_for"';
17
+
18
+ access_log /var/log/nginx/access.log main;
19
+
20
+ client_body_temp_path /var/cache/nginx/client_temp;
21
+ proxy_temp_path /var/cache/nginx/proxy_temp;
22
+ fastcgi_temp_path /var/cache/nginx/fastcgi_temp;
23
+ uwsgi_temp_path /var/cache/nginx/uwsgi_temp;
24
+ scgi_temp_path /var/cache/nginx/scgi_temp;
25
+
26
+ sendfile on;
27
+ keepalive_timeout 65;
28
+
29
+ # GZIP 压缩配置
30
+ gzip on;
31
+ gzip_disable "msie6";
32
+ gzip_vary on;
33
+ gzip_proxied any;
34
+ gzip_comp_level 6;
35
+ gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
36
+
37
+ # 定义限速区域
38
+ limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/m;
39
+
40
+ # 更新 SSL 配置
41
+ ssl_protocols TLSv1.2 TLSv1.3;
42
+ ssl_ciphers HIGH:!aNULL:!MD5;
43
+
44
+ # 优化 SSL 参数
45
+ ssl_prefer_server_ciphers on; # 优先使用服务器的密码套件
46
+ ssl_session_timeout 1d; # SSL 会话超时时间
47
+ ssl_session_cache shared:SSL:50m; # SSL 会话缓存
48
+ ssl_session_tickets off; # 禁用 session tickets
49
+
50
+ # 模拟 Chrome 的 ECDH 曲线
51
+ ssl_ecdh_curve X25519:prime256v1:secp384r1;
52
+
53
+ # 添加上游服务器 SSL 验证配置
54
+ proxy_ssl_protocols TLSv1.2 TLSv1.3;
55
+ proxy_ssl_ciphers HIGH:!aNULL:!MD5;
56
+ proxy_ssl_verify off; # 如果上游证书验证有问题,可以先关闭验证
57
+ proxy_ssl_server_name on; # 启用 SNI 支持
58
 
59
  location / {
60
  proxy_pass http://localhost:3000;