geo ip
This commit is contained in:
18
README.md
18
README.md
@@ -1,2 +1,20 @@
|
|||||||
# nginx
|
# nginx
|
||||||
|
|
||||||
|
## misc
|
||||||
|
|
||||||
|
check version and configure options (includes modules)
|
||||||
|
|
||||||
|
```
|
||||||
|
nginx -V
|
||||||
|
```
|
||||||
|
|
||||||
|
list modules
|
||||||
|
|
||||||
|
```
|
||||||
|
ls /usr/lib/nginx/modules
|
||||||
|
```
|
||||||
|
|
||||||
|
## ngx_http_geoip_module.so;
|
||||||
|
|
||||||
|
[Custom Docker Image](docker/nginx-geoip.DockerFile)
|
||||||
|
|
||||||
|
|||||||
16
docker/nginx-geoip.DockerFile
Normal file
16
docker/nginx-geoip.DockerFile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#tag nginx-geoip
|
||||||
|
FROM nginx
|
||||||
|
|
||||||
|
COPY nginx-geoip.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN curl -O https://dl.miyuru.lk/geoip/dbip/country/dbip.dat.gz
|
||||||
|
RUN mv dbip.dat.gz country.dat.gz
|
||||||
|
RUN gzip -d country.dat.gz
|
||||||
|
RUN cp country.dat /etc/nginx/dbip-country.dat
|
||||||
|
|
||||||
|
RUN curl -O https://dl.miyuru.lk/geoip/dbip/city/dbip.dat.gz
|
||||||
|
RUN mv dbip.dat.gz city.dat.gz
|
||||||
|
RUN gzip -d city.dat.gz
|
||||||
|
RUN cp city.dat /etc/nginx/dbip-city.dat
|
||||||
32
docker/nginx-geoip.conf
Normal file
32
docker/nginx-geoip.conf
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
load_module modules/ngx_http_geoip_module.so;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
http {
|
||||||
|
geoip_country /etc/nginx/dbip-country.dat;
|
||||||
|
geoip_city /etc/nginx/dbip-city.dat;
|
||||||
|
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for" "$geoip_country_code"';
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
#tcp_nopush on;
|
||||||
|
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
#gzip on;
|
||||||
|
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user