File size: 1,961 Bytes
19b91a4
80beaad
19b91a4
 
 
 
 
 
 
 
80beaad
 
 
19b91a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80beaad
 
 
 
 
263a5b7
80beaad
 
19b91a4
 
 
 
 
 
 
 
 
 
80beaad
 
 
 
 
19b91a4
 
 
 
 
 
 
 
 
 
80beaad
19b91a4
 
 
 
 
80beaad
 
 
 
 
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
worker_processes auto;

worker_rlimit_nofile 65535;

events {   
    worker_connections 65535; 
    
    multi_accept on;
    
    use epoll;
}

http {

    # 连接超时设置  
    keepalive_timeout 120;
    keepalive_requests 100; 

    # 压缩设置  
    gzip on;  
    gzip_vary on;  
    gzip_proxied any;  
    gzip_comp_level 6;  
    gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;

    # MIME类型  
    include /etc/nginx/mime.types; 
    
    # 禁用 admin 接口和日志输出
    server {
        listen 3001;

        location /ai/v1/ {
            rewrite ^/ai/v1/(.*)$ /v1/$1 break;
            proxy_pass http://127.0.0.1:3000;
            proxy_set_header Host $host;

            # 清除-敏感头部  
            proxy_set_header X-Forwarded-For "";  
            proxy_set_header X-Real-IP "";  
            proxy_set_header X-Direct-Url "";  
            proxy_set_header X-Forwarded-Port "";  
            proxy_set_header X-Ip-Token "";  
            proxy_set_header X-Request-Id "";  
            proxy_set_header X-Amzn-Trace-Id "";  
            proxy_set_header X-Forwarded-Proto ""; 
        }

        location / {
            proxy_pass http://127.0.0.1:3000;
            proxy_set_header Host $host;

            # 清除-敏感头部  
            proxy_set_header X-Forwarded-For "";  
            proxy_set_header X-Real-IP "";  
            proxy_set_header X-Direct-Url "";  
            proxy_set_header X-Forwarded-Port "";  
            proxy_set_header X-Ip-Token "";  
            proxy_set_header X-Request-Id "";  
            proxy_set_header X-Amzn-Trace-Id "";  
            proxy_set_header X-Forwarded-Proto ""; 
        }

        # 429 错误-页面  
        location = /429.html {  
            return 429 'Too Many Requests';  
        }  
    }

    # 禁用错误日志输出
    error_log /dev/null crit;
}