nginx.conf.j2
3.6 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
worker_processes 4;
worker_cpu_affinity 00000001 00000010 00000100 00001000;
pid /usr/local/openresty/nginx/logs/nginx.pid;
error_log /Data/logs/nginx/nginx_error.log;
worker_rlimit_nofile 51200;
events
{
use epoll;
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 '$remote_addr|$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';
#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 180;
keepalive_requests 1000;
#TCP Options
tcp_nopush on;
tcp_nodelay on;
send_timeout 120s;
#fastcgi options
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 8 128k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
#size limits
client_max_body_size 900m;
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 /usr/local/openresty/nginx/ngx_temp_dir;
proxy_cache_path /usr/local/openresty/nginx/ngx_cache levels=1:2 keys_zone=cache_one:500m inactive=1d max_size=10g;
proxy_connect_timeout 120s;
proxy_read_timeout 300s;
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;
upstream crm_pools {
{% for i in groups['java-crm'] %}
server {{ i }}:8093 max_fails=5 fail_timeout=30s;
{% endfor %}
}
upstream portal-gateway {
{% if upstream_az == 'gray' %}
server 10.66.101.10:8080 max_fails=5 fail_timeout=30s;
{% else %}
{% for i in groups['java-portal-gateway'] %}
server {{ i }}:8080 max_fails=5 fail_timeout=30s;
{% endfor %}
{% endif%}
}
upstream yohobuy-adminstore {
{% for i in groups['java-shops'] %}
server {{ i }}:8098 max_fails=5 fail_timeout=30s;
{% endfor %}
}
upstream extstore {
{% if upstream_az == 'gray' %}
server 10.66.101.10:8094 max_fails=5 fail_timeout=30s;
{% else %}
{% for i in groups['java-extendstore'] %}
server {{ i }}:8094 max_fails=5 fail_timeout=30s;
{% endfor %}
{% endif%}
}
include vhosts/crm.conf;
include vhosts/extstore.conf;
include vhosts/shop.conf;
include vhosts/adminstore.yohobuy.conf;
}