Allow config to disable geoip (#2202)
For a offline or private cloud environment, geoip is not needed. Implementing https://github.com/kubernetes/ingress-nginx/issues/2179
This commit is contained in:
parent
c90a4e811e
commit
5c02d700cb
4 changed files with 15 additions and 2 deletions
|
@ -82,6 +82,7 @@ The following table shows a configuration option's name, type, and the default v
|
|||
|[ssl-buffer-size](#ssl-buffer-size)|string|"4k"|
|
||||
|[use-proxy-protocol](#use-proxy-protocol)|bool|"false"|
|
||||
|[use-gzip](#use-gzip)|bool|"true"|
|
||||
|[use-geoip](#use-geoip)|bool|"true"|
|
||||
|[enable-brotli](#enable-brotli)|bool|"true"|
|
||||
|[brotli-level](#brotli-level)|int|4|
|
||||
|[brotli-types](#brotli-types)|string|"application/xml+rss application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component"|
|
||||
|
@ -461,6 +462,11 @@ Enables or disables the [PROXY protocol](https://www.nginx.com/resources/admin-g
|
|||
Enables or disables compression of HTTP responses using the ["gzip" module](http://nginx.org/en/docs/http/ngx_http_gzip_module.html).
|
||||
The default mime type list to compress is: `application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component`.
|
||||
|
||||
## use-geoip
|
||||
|
||||
Enables or disables ["geoip" module](http://nginx.org/en/docs/http/ngx_http_geoip_module.html) that creates variables with values depending on the client IP address, using the precompiled MaxMind databases.
|
||||
The default value is true.
|
||||
|
||||
## enable-brotli
|
||||
|
||||
Enables or disables compression of HTTP responses using the ["brotli" module](https://github.com/google/ngx_brotli).
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -340,6 +340,10 @@ type Configuration struct {
|
|||
// http://nginx.org/en/docs/http/ngx_http_gzip_module.html
|
||||
UseGzip bool `json:"use-gzip,omitempty"`
|
||||
|
||||
// Enables or disables the use of the nginx geoip module that creates variables with values depending on the client IP
|
||||
// http://nginx.org/en/docs/http/ngx_http_geoip_module.html
|
||||
UseGeoIP bool `json:"use-geoip,omitempty"`
|
||||
|
||||
// Enables or disables the use of the NGINX Brotli Module for compression
|
||||
// https://github.com/google/ngx_brotli
|
||||
EnableBrotli bool `json:"enable-brotli,omitempty"`
|
||||
|
@ -542,6 +546,7 @@ func NewDefault() Configuration {
|
|||
SSLSessionTimeout: sslSessionTimeout,
|
||||
EnableBrotli: false,
|
||||
UseGzip: true,
|
||||
UseGeoIP: true,
|
||||
WorkerProcesses: strconv.Itoa(runtime.NumCPU()),
|
||||
WorkerShutdownTimeout: "10s",
|
||||
LoadBalanceAlgorithm: defaultLoadBalancerAlgorithm,
|
||||
|
|
|
@ -81,6 +81,7 @@ http {
|
|||
set_real_ip_from {{ $trusted_ip }};
|
||||
{{ end }}
|
||||
|
||||
{{ if $cfg.UseGeoIP }}
|
||||
{{/* databases used to determine the country depending on the client IP address */}}
|
||||
{{/* http://nginx.org/en/docs/http/ngx_http_geoip_module.html */}}
|
||||
{{/* this is require to calculate traffic for individual country using GeoIP in the status page */}}
|
||||
|
@ -88,6 +89,7 @@ http {
|
|||
geoip_city /etc/nginx/geoip/GeoLiteCity.dat;
|
||||
geoip_org /etc/nginx/geoip/GeoIPASNum.dat;
|
||||
geoip_proxy_recursive on;
|
||||
{{ end }}
|
||||
|
||||
{{ if $cfg.EnableVtsStatus }}
|
||||
vhost_traffic_status_zone shared:vhost_traffic_status:{{ $cfg.VtsStatusZoneSize }};
|
||||
|
|
Loading…
Reference in a new issue