-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathnginx.conf
93 lines (72 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
user nginx;
# number of CPU cores
worker_processes 2;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
load_module "modules/ngx_http_geoip_module.so";
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# extended log with IP before proxy and request time for the performance monitoring
# goaccess --log-format='%h %^ %^ [%d:%t] "%r" %s %b "%R" "%u" %^ "%T"' --time-format='%H:%M:%S %z' --date-format='%d/%b/%Y'
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$request_time"';
# log full request body for debugging - WARINING, log may contain sensitive information
log_format debug '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$request_body"';
# logstach json format
log_format logstash_json '{ "@timestamp": "$time_iso8601", '
'"@fields": { '
'"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", '
'"request_method": "$request_method", '
'"request": "$request", '
'"status": "$status", '
'"body_bytes_sent": "$body_bytes_sent", '
'"http_referrer": "$http_referer", '
'"http_user_agent": "$http_user_agent", '
'"http_x_forwarded_for": "$http_x_forwarded_for", '
'"request_time": "$request_time", } }';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
keepalive_timeout 20 15;
client_body_timeout 15;
client_header_timeout 15;
send_timeout 10;
gzip on;
gzip_static on;
gzip_comp_level 3;
gzip_min_length 1024;
gzip_vary on;
# Client setings
client_max_body_size 50M;
fastcgi_buffers 256 4k;
client_body_buffer_size 10K;
client_header_buffer_size 2k;
large_client_header_buffers 2 2k;
# Slow Loris protection
#client_body_timeout 10s;
#client_header_timeout 10s;
ssl_session_cache shared:ssl_session_cache:30m;
ssl_session_timeout 1d;
# Microcache
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=microcache:20m inactive=1d max_size=512M;
# fbclid mapper
map $request_uri $redirect_fbclid {
"~^(.*?)([?&]fbclid=[a-zA-Z0-9_-]+)$" $1;
}
# GeoIP
geoip_country /etc/nginx/GeoIP.dat;
# another server settings
include /etc/nginx/conf.d/*.conf;
# virtual hosts settings in vhosts.d:
include /etc/nginx/vhosts.d/*.conf;
}