-
Notifications
You must be signed in to change notification settings - Fork 7
/
nginx.conf
104 lines (89 loc) · 2.61 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
100
101
102
103
104
# /etc/nginx/conf.d/default.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
upstream app {
#默认负载均衡配置(轮询)
#最少连接负载均衡
#least_conn;
#会话持久化(ip-hash),绑定客户端和服务器
#ip_hash;
#带权重的负载均衡,weight=3;
server 127.0.0.1:5000 weight=1 max_fails=2 fail_timeout=1200s;
#server 127.0.0.1:5001 weight=1 max_fails=2 fail_timeout=30s;
keepalive 300;
}
sendfile on;
gzip on;
gzip_types text/plain application/xml application/json;
gzip_min_length 1000;
gzip_comp_level 5;
#全局post上传最大为10M,全部存在内存里
client_max_body_size 100M;
client_body_buffer_size 100M;
keepalive_timeout 1200s ;
keepalive_requests 10000;
proxy_connect_timeout 6000s;
proxy_send_timeout 6000s;
proxy_read_timeout 6000s;
# 502 bad gateway 错误解决配置 start
proxy_buffer_size 64k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
# 502 bad gateway 错误解决配置 end
# HTTP server configuration
server {
listen 22771;
location /url {
alias /app/ini;
autoindex on;
autoindex_exact_size off;
}
location /secret {
alias /app/secret;
autoindex on;
autoindex_exact_size off;
}
location /youtube {
proxy_buffer_size 4m;
proxy_buffers 60 5m;
proxy_busy_buffers_size 200m;
proxy_pass http://app/youtube;
}
location /bilibili {
proxy_buffer_size 5m;
proxy_buffers 60 7m;
proxy_busy_buffers_size 300m;
proxy_pass http://app/bilibili;
}
location /huya {
proxy_buffer_size 4m;
proxy_buffers 60 5m;
proxy_busy_buffers_size 200m;
proxy_pass http://app/huya;
}
location /YY {
proxy_buffer_size 4m;
proxy_buffers 60 5m;
proxy_busy_buffers_size 200m;
proxy_pass http://app/YY;
}
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://app;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Cache-Control no-store;
add_header Pragma no-cache;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
}