geoip

Nginx geoip redirect , but exclude URL

霸气de小男生 提交于 2021-01-29 11:10:04
问题 Currently, I have the following setup for GeoIP redirect in Nginx: set $fromAU 0; set $isAUuri 0; set $isUSuri 0; if ( $geoip_country_code = "AU" ) { set $fromAU 1; } if ( $request_uri ~* "^/australia" ) { set $isAUuri 1; } if ( $request_uri ~* "^/usa-can" ) { set $isUSuri 1; } if ( $request_uri ~* ^/(wp-admin|wp-login\.php) ) { set $isUSuri 1; } set $redirectableAU "${fromAU}${isAUuri}"; if ( $redirectableAU = "10" ) { rewrite "^(/australia)?(.*)" $scheme://$host/australia permanent; } if (

Query by city name on geolite2 .mmdb file (JAVA)

狂风中的少年 提交于 2021-01-27 17:02:01
问题 I am using GeoLite2 to get Location by IP address for my java appliccation. I want to get country by city from GeoLite2-City.mmdb file. This is my reader : DatabaseReader reader = new DatabaseReader.Builder(dbFileStream).withCache(new CHMCache()).build(); I am getting CityResponse by IP address like below : CityResponse cityResponse = reader.city(InetAddress.getByName("an IP address")); But I want to get Country name by city like this : String countryName = reader.getCountryByCity("Paris”);

Get the geo located Country and State in Woocommerce 3

一曲冷凌霜 提交于 2021-01-01 08:01:20
问题 I am making a plugin to display estimate shipping/delivery time depend on visitor IP address. To do this I am using WC_Geolocation but using this I can get only visitor country code like US CA etc how can I get visitor state name if county is US . $geoData = WC_Geolocation::geolocate_ip(); $country = $geoData['country']; echo $country; will output country code. how to get state name? 回答1: To get the geolocated state : // Get an instance of the WC_Geolocation object class $geo_instance = new

Get the geo located Country and State in Woocommerce 3

心不动则不痛 提交于 2021-01-01 08:00:47
问题 I am making a plugin to display estimate shipping/delivery time depend on visitor IP address. To do this I am using WC_Geolocation but using this I can get only visitor country code like US CA etc how can I get visitor state name if county is US . $geoData = WC_Geolocation::geolocate_ip(); $country = $geoData['country']; echo $country; will output country code. how to get state name? 回答1: To get the geolocated state : // Get an instance of the WC_Geolocation object class $geo_instance = new

Call reference for country in GeoLite2 using PHP

余生长醉 提交于 2020-06-08 06:24:42
问题 I'm trying to use the free MaxMind GeoLite2 code to be able to determine the country of a specific IP address. I am using the Composer-free method that was posted here: Get a localized name of the users city via Maxmind GeoLite2 Free I'm sure its incredibly simple, but I can't figure out how to actually pass an IP address and have it return the country. After the $reader = new Reader... line I have $place = $reader->country('##.###.##.###'); (where the #'s are actual IP address numbers) and

Turn Woocommerce shop into catalog for geolocated countries?

我只是一个虾纸丫 提交于 2020-05-13 14:26:08
问题 I'm trying to turn my woocommerce shop into catalog mode depends on country.I only want to show products' price and add to cart function in United States. I'm trying to achieve this by using a plugin called "GeoIP Detection" with the following code in the PHP: /* Disable purchasing of products if the country is not United States*/ add_filter('woocommerce_is_purchasable', 'flatsome_woocommerce_is_purchasable', 10, 2); function flatsome_woocommerce_is_purchasable($is_purchasable, $product) {

docker之Dockerfile实践

雨燕双飞 提交于 2020-04-05 18:02:45
https://blog.csdn.net/wuapeng/article/details/80974417 docker之Dockerfile实践 上一篇介绍了Dockerfile中使用的指令,现在开始进行指令实践 先查看下本地的镜像,选一个作为base image: [root@docker ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE wadeson/centos_nginx v1 210a202d37b8 2 hours ago 464MB nginx latest c59f17fe53b0 4 days ago 108MB ubuntu latest 747cb2d60bbe 3 weeks ago 122MB centos latest 196e0ce0c9fb 6 weeks ago 197MB 在某一个目录下面创建一个专门存放此demo的目录,也就是Dockerfile所在的context: [root@docker ~]# mkdir docker_demo [root@docker ~]# cd docker_demo/ [root@docker docker_demo]# touch Dockerfile [root@docker docker_demo]# pwd /root/docker

ELK 之三:Kibana 使用与Tomcat、Nginx 日志格式处理

有些话、适合烂在心里 提交于 2020-03-31 16:10:56
一:kibana安装:   kibana主要是搜索elasticsearch的数据,并进行数据可视化的展现,新版使用nodejs。 1、下载地址: https://www.elastic.co/downloads/kibana 2、解压安装: [root@node6 local]# tar xvf kibana-4.1.1-linux-x64.tar.gz [root@node6 local]# mv kibana-4.1.1-linux-x64 kibana [root@node6 ~]# cd /usr/local/kibana/ [root@node6 kibana]# ls bin config LICENSE.txt node plugins README.txt src 3、编辑配置文件: [root@node6 kibana]# cd config/ [root@node6 config]# ls kibana.yml [root@node6 config]# vim kibana.yml elasticsearch_url: "http://192.168.10.206:9200" 4、直接启动: [root@node6 kibana]# bin/kibana {"name":"Kibana","hostname":"node6.a.com","pid":3942,

Logstash详解

╄→гoц情女王★ 提交于 2020-03-29 23:31:17
Logstash详解 一,简介 ​ Logstash是一款开源的日志采集,处理,输出的软件,每秒可以处理数以万计条数据,可以同时从多个来源采集数据,转换数据,然后将数据输出至自己喜欢的存储库中(官方推荐的存储库为Elasticsearch) ​ 如图所示logstash的工作机制,数据从来源进入logstash,进行过滤最后输出到目标. Logstash处理日志需要借助于大量的插件来完成.主要有以下三类插件, Input plugins Filter plugins Output plugins 二,安装配置 2.1、二进制包方式安装 ​ 软件下载链接 https://www.elastic.co/downloads/logstash ​ 由于logstash是java语言开发的,所以需要安装下jdk, 这里安装的logstash为6.x的版本,官方要求使用java8 #安装jdk,去oracle官网下载jdk tar xvf jdk-8u181-linux-x64.tar.gz -C /usr/java/ #配置java环境变量 vim /etc/profile.d/java.sh #内容如下 JAVA_HOME=/usr/java/jdk1.8.0_181 PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME PATH #加载java的环境变量