forked from chaizhenhua/ngx-ip2location
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf.example
65 lines (53 loc) · 2.68 KB
/
nginx.conf.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
worker_processes 1;
error_log logs/error.log debug;
working_directory /usr/local/nginx;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
ip2location on;
ip2location_database /usr/local/nginx/conf/IP-COUNTRY-SAMPLE.BIN;
ip2location_access_type shared_memory;
server {
listen 80;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
# pass ip2location variable to PHP
fastcgi_param IP2LOCATION_COUNTRY_SHORT $ip2location_country_short;
fastcgi_param IP2LOCATION_COUNTRY_LONG $ip2location_country_long;
fastcgi_param IP2LOCATION_REGION $ip2location_region;
fastcgi_param IP2LOCATION_CITY $ip2location_city;
fastcgi_param IP2LOCATION_ISP $ip2location_isp;
fastcgi_param IP2LOCATION_LATITUDE $ip2location_latitude;
fastcgi_param IP2LOCATION_LONGITUDE $ip2location_longitude;
fastcgi_param IP2LOCATION_DOMAIN $ip2location_domain;
fastcgi_param IP2LOCATION_ZIPCODE $ip2location_zipcode;
fastcgi_param IP2LOCATION_TIMEZONE $ip2location_timezone;
fastcgi_param IP2LOCATION_NETSPEED $ip2location_netspeed;
fastcgi_param IP2LOCATION_IDDCODE $ip2location_iddcode;
fastcgi_param IP2LOCATION_AREACODE $ip2location_areacode;
fastcgi_param IP2LOCATION_WEATHERSTATIONCODE $ip2location_weatherstationcode;
fastcgi_param IP2LOCATION_WEATHERSTATIONNAME $ip2location_weatherstationname;
fastcgi_param IP2LOCATION_MCC $ip2location_mcc;
fastcgi_param IP2LOCATION_MNC $ip2location_mnc;
fastcgi_param IP2LOCATION_ELEVATION $ip2location_elevation;
fastcgi_param IP2LOCATION_USAGETYPE $ip2location_usagetype;
}
# redirect all ip address from UK to http://www.google.co.uk
if ($ip2location_country_short ~ ^UK$) {
rewrite ^(.*)$ http://www.google.co.uk last;
}
}
}