Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';t启用geoip阻塞nginx-[emerg]未知指令“;geoip“国家”;_Nginx_Geoip - Fatal编程技术网

Can';t启用geoip阻塞nginx-[emerg]未知指令“;geoip“国家”;

Can';t启用geoip阻塞nginx-[emerg]未知指令“;geoip“国家”;,nginx,geoip,Nginx,Geoip,我试图在Nginx上启用geoIP阻塞,但我得到一个错误。 我已经在其他VP上使用了它,没有问题 /etc/nginx/sites-enabled # nginx -V nginx version: nginx/1.10.3 built with OpenSSL 1.1.0l 10 Sep 2019 TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx

我试图在Nginx上启用geoIP阻塞,但我得到一个错误。 我已经在其他VP上使用了它,没有问题

/etc/nginx/sites-enabled # nginx -V
nginx version: nginx/1.10.3
built with OpenSSL 1.1.0l  10 Sep 2019
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-GAwZrH/nginx-1.10.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=/build/nginx-GAwZrH/nginx-1.10.3/debian/modules/nginx-auth-pam --add-dynamic-module=/build/nginx-GAwZrH/nginx-1.10.3/debian/modules/nginx-dav-ext-module --add-dynamic-module=/build/nginx-GAwZrH/nginx-1.10.3/debian/modules/nginx-echo --add-dynamic-module=/build/nginx-GAwZrH/nginx-1.10.3/debian/modules/nginx-upstream-fair --add-dynamic-module=/build/nginx-GAwZrH/nginx-1.10.3/debian/modules/ngx_http_substitutions_filter_module
nginx.conf规则

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    ##
    # GeoBlock
    ##
    geoip_country /usr/share/GeoIP/GeoIP.dat;
    map $geoip_country_code $allowed_country {
            default yes;
            #RU no;
            CN no;
            KOR no;
    }
模块geoip已启用

/etc/nginx/sites-enabled # find /etc/ -name '*geoip.conf*'
/etc/nginx/modules-enabled/50-mod-http-geoip.conf
nginx已完全安装

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

您的
nginx-V
表示
--with-http\u geoip\u module=dynamic


那么,您的指令在哪里?

在哪个块中是
geoip\u country
指令?在“http”中,我已经更新了应答器编号:)模块启用了include/etc/nginx/modules enabled/*.conf;现在可以了,谢谢