IPアドレスのデータベースをダウンロードしてください:
ナショナルデータベース:http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
市データベース:http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
http {
geoip_country /path/to/GeoIP.dat;
geoip_city /path/to/GeoLiteCity.dat;
server{
listen 3592;
server_name www.siguoya.name;
location / {
default_type text/plain;
if ($geoip_country_code != 'CN'){
return 403;
}
return 200 "$remote_addr $geoip_city_country_name $geoip_country_code $geoip_city";
}
}
}
アクセス:http://www.siguoya.name:3592/
119.32.216.122 China CN Guangzhou
読むのトピック
- 1. nginxの利点
- カイから2 nginxのインストールと起動
- 3. nginxの設定構文とディレクトリ
- 4. nginxのモジュール
- 5. nginxの静的なリソースを扱います
- 6. nginxのブラウザのキャッシュの原則
- 7.クロスドメインアクセスリソースnginxの
- 盗難防止チェーン8 nginxのリソース
- 9. nginxのプロキシ
- 10. nginxのロードバランシング
- 11. nginxのキャッシュ
- 12. nginxの静的及び動的分離
- 13. nginxの書き換え
- 14. nginxのセキュアリンク
- 15. nginxのジオ
- 16. nginxのHTTPSサービス
- 17. nginxのとのLuaの開発
- 18. nginxの放出およびグレーのLUA
- 19. nginxのの共通のエラー
- 20. nginxのパフォーマンスの最適化
- 21. nginxのセキュリティ管理