diff --git a/README.md b/README.md index f17ba80..8c9cc18 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,20 @@ # 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) + diff --git a/docker/nginx-geoip.DockerFile b/docker/nginx-geoip.DockerFile new file mode 100644 index 0000000..6630b6b --- /dev/null +++ b/docker/nginx-geoip.DockerFile @@ -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 \ No newline at end of file diff --git a/docker/nginx-geoip.conf b/docker/nginx-geoip.conf new file mode 100644 index 0000000..1da0717 --- /dev/null +++ b/docker/nginx-geoip.conf @@ -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; +} \ No newline at end of file