nginx.conf
6.95 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
###docker-az2#####
user www www;
worker_processes 4;
worker_cpu_affinity 00000001 00000010 00000100 00001000;
pid /usr/local/openresty/nginx/logs/nginx.pid;
# [ debug | info | notice | warn | error | crit ]
error_log /Data/logs/nginx/nginx_error.log;
#error_log /dev/null;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events
{
use epoll;
#maxclient = worker_processes * worker_connections / cpu_number
worker_connections 51200;
}
http
{
include /usr/local/openresty/nginx/conf/mime.types;
default_type application/octet-stream;
#charset gb2312,utf-8;
charset utf-8;
log_format fenxi '$http_x_forwarded_for|$http_x_forwarded_for|[$time_local]|$http_host|$request|'
'$status|$body_bytes_sent|$request_time|$upstream_response_time|$upstream_cache_status|$http_referer|'
'$upstream_addr|$http_user_agent';
#log_format main '$remote_addr - $remote_user [$time_local] $request $request_body '
# '"$status" $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for" "$request_time"';
# access_log /log/access.log main;
#access_log /Data/logs/access_yohoshow.com.log main;
#error_page 502 =200 /.busy.jpg;
#error_page 403 = http://www.yohoboys.com;
#error_page 404 = http://www.yohoboys.com;
#General Options
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_body_buffer_size 8m; #256k
#
#server_tokens off;
ignore_invalid_headers on;
recursive_error_pages on;
server_name_in_redirect off;
sendfile on;
#timeouts
keepalive_timeout 75s;
keepalive_requests 10000;
#test
#client_body_timeout 3m;
#client_header_timeout 3m;
#send_timeout 3m;
#TCP Options
tcp_nopush on;
tcp_nodelay on;
#fastcgi options
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
#set_real_ip_from 10.0.0.0/16;
#real_ip_header X-Forwarded-For;
#hiden php version
fastcgi_hide_header X-Powered-By;
#size limits
client_max_body_size 50m;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#proxy_temp_path /dev/shm/proxy_temp;
proxy_temp_path /usr/local/openresty/nginx/ngx_temp_dir;
proxy_cache_path /usr/local/openresty/nginx/ngx_cache_activity levels=1:2 keys_zone=cache_one_activity:100m inactive=60m use_temp_path=off max_size=2g;
proxy_cache_path /usr/local/openresty/nginx/ngx_cache levels=1:2 keys_zone=cache_one:500m inactive=1d max_size=2g;
proxy_cache_path /usr/local/openresty/nginx/ngx_cache_pc levels=1:2 keys_zone=cache_one_pc:1024m inactive=1d max_size=2g;
proxy_cache_path /usr/local/openresty/nginx/ngx_cache_wap levels=1:2 keys_zone=cache_one_wap:1024m inactive=1d max_size=2g;
proxy_cache_path /usr/local/openresty/nginx/ngx_cache_spider levels=1:2 keys_zone=cache_one_spider:1024m inactive=3d max_size=30g;
proxy_connect_timeout 10;
proxy_read_timeout 60;
proxy_send_timeout 10;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
fastcgi_temp_path /dev/shm/fastcgi_temp;
client_body_temp_path /dev/shm/client_body_temp;
# add limit req for all request
limit_req_zone '$host$uri' zone=limit_per_url_50:50m rate=50r/s;
limit_req_zone '$host$uri' zone=limit_per_url_100:50m rate=100r/s;
limit_req_zone '$host$uri' zone=limit_per_url_200:50m rate=200r/s;
limit_req_zone '$host$uri' zone=limit_per_url_500:50m rate=500r/s;
limit_req_zone '$host$uri' zone=limit_per_url_1000:50m rate=1200r/s;
# add limit req for web order submit
limit_req_zone $binary_remote_addr zone=web_order:30m rate=5r/s;
#upstream web
upstream yoho-web-new-inner {
server 10.66.16.101;
}
upstream yohobuywap-node-activity-upstream {
server 10.66.16.101;
keepalive 100;
}
upstream xianyu-yohobuy-node {
server 10.66.16.101 weight=6 max_fails=2 fail_timeout=5s;
keepalive 100;
}
#upstream
upstream globalbs {
server 10.66.5.17:8080 weight=6 max_fails=5 fail_timeout=5s;
server 10.66.5.187:8080 weight=6 max_fails=5 fail_timeout=5s;
}
upstream globalbuyapi {
server 10.66.16.101 weight=6 max_fails=2 fail_timeout=5s;
}
upstream yohobuy-node {
server 10.66.16.101 weight=6 max_fails=2 fail_timeout=5s;
keepalive 100;
}
upstream yohobuy-shop-manage {
server 10.66.16.101;
}
upstream yohobuy-shops {
server 10.66.50.140:30016;
}
upstream yohobuy-platform {
server 10.66.50.140:8088;
}
upstream yohobuywap-node {
server 10.66.16.101 weight=6 max_fails=2 fail_timeout=5s;
keepalive 100;
}
#upstream
fastcgi_next_upstream error timeout invalid_header http_500;
#limit_req
geo $whiteiplist {
default 1;
127.0.0.1 0;
10.0.0.0/8 0;
172.0.0.0/8 0;
218.94.77.166/32 0;
218.94.75.58/32 0;
218.94.75.50/32 0;
}
map $whiteiplist $limit {
1 $binary_remote_addr;
0 "";
}
limit_req_zone $limit zone=allips_per_ip_10:50m rate=10r/s;
limit_req_zone $limit zone=allips_per_ip_20:50m rate=20r/s;
limit_req_zone $limit zone=allips_per_ip_50:50m rate=50r/s;
limit_req_zone $limit zone=allips_per_ip_100:50m rate=100r/s;
#fastcgi cache
#fastcgi_cache_path /nginxcache levels=1:2 keys_zone=two:10m inactive=1d max_size=3000m;
include vhosts/activity.yohocn.conf;
include vhosts/action.yohocn.conf;
include vhosts/shopmanage.yohobuy.com.conf;
include vhosts/xianyu.yohobuy.com.conf;
include vhosts/yohobuypc_spider.conf;
include vhosts/yohobuypc.conf;
include vhosts/yohobuywap.conf;
include vhosts/yohoglobalbs.conf;
}