Nginx GeoIPモジュールをcentos6にインストールしようとしています。
私はそれをインストールするには、このガイドを使用しています: How to install Nginx GeoIP module
をしかし、私はnginx.cof
でのGeoIPのパスを設定しようとすると、私はこの問題に直面します。nginxでgeoIpへのパスを設定する方法
nginxの:[EMERG]未知のディレクティブ「geoip_country」で /etc/nginx/nginx.conf:7 nginxの:
設定ファイル /etc/nginx/nginx.confテストは
を失敗し、これらはI'vはnginx.conf
に追加線です:
geoip_country /usr/local/share/GeoIP/GeoIP.dat;
geoip_city /usr/local/share/GeoIP/GeoLiteCity.dat;
私は、グーグルでこのISSUを検索1つの答えは、それがmain{}
セクションでなければなりませんでしたが、私はnginx.confでmain{}
を挿入し、そこに行を挿入するとき、私は別のエラーがmain{}
が間違っていると言う参照してください!また、私はmain{}
が同じnginx.confファイルであることを他の場所で読んでいます!
私はとても混乱しています。誰もがこれで私を助けることができますか?
[UPDATE]
これは私のnginx.confのHTTPセクションです:
http {
include /etc/nginx/mime.types;
# For user configurations not maintained by DirectAdmin. Empty by default.
include /etc/nginx/nginx-includes.conf;
# Supplemental configuration
include /etc/nginx/nginx-modsecurity-enable.conf;
include /etc/nginx/nginx-defaults.conf;
include /etc/nginx/nginx-gzip.conf;
include /etc/nginx/directadmin-ips.conf;
include /etc/nginx/directadmin-settings.conf;
include /etc/nginx/nginx-vhosts.conf;
include /etc/nginx/directadmin-vhosts.conf;
geoip_country /usr/local/share/GeoIP/GeoIP.dat;
geoip_city /usr/local/share/GeoIP/GeoLiteCity.dat;
# Set php-fpm geoip variables
fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
fastcgi_param GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
fastcgi_param GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
fastcgi_param GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
fastcgi_param GEOIP_REGION $geoip_region;
fastcgi_param GEOIP_CITY $geoip_city;
fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
fastcgi_param GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
fastcgi_param GEOIP_LATITUDE $geoip_latitude;
fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
}
はそれで何か問題はありますか?
私はhttpセクションの中に配置しましたが、同じエラーが表示されます。 –