geoip2-nginx/conf/nginx.conf

39 lines
945 B
Nginx Configuration File
Raw Normal View History

load_module /usr/lib/nginx/modules/ngx_http_geoip2_module.so;
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
geoip2 /var/lib/GeoIP/GeoLite2-Country.mmdb {
$geoip2_data_country_iso_code country iso_code;
}
map $geoip2_data_country_iso_code $allowed_country {
default yes;
BD no;
}
log_format main '$geoip2_data_country_iso_code $remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
}