diretiva desconhecida “geoip_country” no ubuntu 16.04 nginx version 1.12.1

0

Eu instalei o geoip_country usando o chef. Tentei o mesmo manualmente, mas o resultado é o mesmo.

recebendo erro:

nginx -t
nginx: [emerg] unknown directive "geoip_country" in /etc/nginx/nginx.conf:12
nginx: configuration file /etc/nginx/nginx.conf test failed

aqui é a versão que eu usei:

nginx -v
nginx version: nginx/1.12.1

meu arquivo de criptografia nginx:

/etc/nginx/nginx.conf
user www-data;
worker_processes 4;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;
events {
  worker_connections  1024;
}

http {

 geoip_country /etc/nginx/geoip/GeoIP.dat; # the country IP database
 geoip_city /etc/nginx/geoip/GeoLiteCity.dat; # the city IP database

  include       /etc/nginx/mime.types;
  default_type  application/octet-stream;
  charset_types text/css text/plain text/vnd.wap.wml application/javascript application/json application/rss+xml application/xml;


  access_log    /var/log/nginx/access.log;

  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;

  keepalive_requests 100;
  keepalive_timeout  65;


  gzip  on;
  gzip_http_version 1.0;
  gzip_comp_level 2;
  gzip_proxied any;
  gzip_vary off;
  gzip_types text/plain text/css application/x-javascript text/xml application/xml application/rss+xml application/atom+xml image/svg+xml text/javascript application/javascript application/json text/mathml;
  gzip_min_length  1000;
  gzip_disable     "MSIE [1-6]\.";


  variables_hash_max_size 1024;
  variables_hash_bucket_size 64;
  server_names_hash_bucket_size 64;
  types_hash_max_size 2048;
  types_hash_bucket_size 64;
  client_max_body_size 128M;



  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;
}

as etapas a seguir foram as etapas a seguir para configurar o geoip

mkdir /etc/nginx/geoip
cd /etc/nginx/geoip
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz
    
por George Ulahannan 27.09.2017 / 14:16

1 resposta

0

Basta instalar o pacote "nginx-full" para corrigir o problema.

apt-get install nginx-full
    
por George Ulahannan 27.09.2017 / 14:49