forked from Umkus/ip-index
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
106 lines (86 loc) · 3.02 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
105
106
worker_processes auto;
worker_rlimit_nofile 32768;
daemon off;
events
{
worker_connections 16384;
multi_accept on;
}
http
{
variables_hash_max_size 1024;
map_hash_max_size 2048;
server_names_hash_max_size 1024;
types_hash_max_size 1024;
open_file_cache max=300;
open_file_cache_errors on;
keepalive_timeout 10;
client_header_timeout 10;
client_body_timeout 10;
client_max_body_size 1M;
send_timeout 10;
types {
application/json json map;
application/javascript js;
audio/mpeg mp3;
image/jpeg jpeg jpg;
image/png png;
image/x-icon cur ico;
image/svg+xml svg;
text/css css;
text/html htm html;
text/plain txt;
}
# default_type image/jpeg;
msie_padding off;
max_ranges 0;
charset utf-8;
index index.html index.htm;
reset_timedout_connection on;
keepalive_disable none;
keepalive_requests 100;
server_tokens off;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
log_format main '$proxy_add_x_forwarded_for - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $upstream_cache_status $upstream_connect_time $upstream_response_time $request_time';
error_log /var/log/nginx/error.log warn;
access_log /var/log/nginx/access.log main;
log_not_found off;
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=cached:10m inactive=24h max_size=1g;
limit_conn_zone $proxy_add_x_forwarded_for zone=conPerIp:50m;
limit_req_zone $proxy_add_x_forwarded_for zone=reqPerSec:50m rate=3r/s;
expires -1;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_comp_level 1;
upstream ipindex-node {
server ipindex-node:4000;
}
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 5s;
proxy_send_timeout 5s;
proxy_read_timeout 5s;
proxy_pass_request_headers on;
underscores_in_headers on;
server {
server_name default;
listen 80 default_server;
root /var/www/;
proxy_cache cached;
proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
# limit_req zone=reqPerSec burst=10; # Uncomment for request throttling
# limit_conn conPerIp 10; # Uncomment for connections throttling
location /favicon.ico {
expires 86400;
access_log off;
return 204;
}
rewrite ^/([0-9.]+)$ /?ip=$1;
location / {
proxy_pass http://ipindex-node;
}
}
}