-
Notifications
You must be signed in to change notification settings - Fork 3
/
nginx.conf
81 lines (65 loc) · 1.92 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
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
http {
# Basic Settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Logging Settings
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log notice;
# Gzip Settings
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
http {
limit_req_zone $binary_remote_addr zone=one:100m rate=10r/s;
limit_req_log_level notice;
server {
listen 80;
server_name localhost;
# this is purposefully set high right now
# so that it will pass on long URIs to GA
# this should be replaced with nginx returning
# a valid 414 page when the buffer = 2k (GA's limit)
large_client_header_buffers 8 32k;
location / {
limit_req zone=one burst=1;
proxy_pass https://www.googleapis.com:443/analytics/v3/data/ga;
}
location /legacy {
limit_req zone=one burst=1;
proxy_pass https://www.googleapis.com:443/analytics/v2.4/data;
}
}
}
http {
limit_req_zone $binary_remote_addr zone=two:100m rate=42r/s;
limit_req_log_level notice;
log_format timed_combined '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time $upstream_response_time';
access_log /var/log/nginx/access.log timed_combined;
server {
listen 8080;
server_name localhost;
large_client_header_buffers 8 2020;
# 414.html is locationed in /usr/share/nginx/html/
error_page 414 /414.html;
location = / {
limit_req zone=two burst=5;
proxy_connect_timeout 50s;
proxy_pass https://www.googleapis.com:443/analytics/v3/data/ga;
}
}
}