DELIMITER $$
-- --------------------------------------------------------------------------------
-- Routine DDL
-- --------------------------------------------------------------------------------
-- Note: add your server side comments to remember what this routine does on your Api
-- --------------------------------------------------------------------------------
DROP FUNCTION IF EXISTS `IfNullOrEmpty`$$
CREATE FUNCTION `IfNullOrEmpty`(s TEXT, value TEXT) RETURNS TEXT
NOT DETERMINISTIC
READS SQL DATA
BEGIN

IF ( (s is null) OR (trim(s) = '')  ) THEN
    return value;
END IF;
return s;    
END$$
SELECT IfNullOrEmpty(t.FieldName,'No Name ') as Name FROM cms_Table t



ifnull 만 할 경우 '' 빈 문자열 체크가 안되어 IfNullOrEmpty 만들어서 사용

Posted by [czar]
,

serialVersionUID 내용은 다음이 잘 정리되어있었습니다. [Java] serialVersionUID의 의미와 붙이는 방법 

  1. AndroidStudio -> Settings -> Editor -> Inspections -> Serialization issues -> "Serializable class without 'serialVersionUID"에 체크
  2. AndroidStudio -> Settings -> Plugins -> Browse repositories ... -> GenerateSerialVersionUID 설​​치
  3. Code -> Genarate ... -> SerialVersionUID    아니면 해당 소스에서 Alt + Insert 하면 SerialVersionUID   항목이 나옴.


Posted by [czar]
,

리눅스 관리 스크립트

리눅스 상태 모니터링 스크립트


vi check.sh



echo -e "\n 1. 오늘날자:"
date
echo -e "\n 2. 디스크용량"
df -h
echo -e "\n 3. 포트점검"
netstat -an | grep LISTEN
echo -e "\n 4. /tmp점검"
ls -al /tmp
echo -e "\n 5. /var/tmp점검"
ls -al /var/tmp
echo -e "\n 6.  큐에쌓인메일수 점검"
ls -l /var/spool/mqueue | wc -l
echo -e "\n 7. 실행프로세스 점검"
pstree
echo -e "\n 8. 최후접속자 점검"
lastlog | grep -v "한번도"

echo -e "\n 9. Memory"
free
echo -e "\n 10. Uptime"
uptime

~
~
~
~
~
~

Posted by [czar]
,

http://www.polygon.com/2016/3/29/11324914/lego-reveals-new-disney-minifigs



Top row: Syndrome, Ariel, Aladdin, Captain Hook, Donald Duck, Minnie Mouse, Mickey Mouse, Daisy Duck, Maleficent. 

Bottom row: Stitch, Ursula, Alice (in Wonderland), Cheshire Cat, Peter Pan, Mr. Incredible, Buzz Lightyear, Pizza Planet Alien, Genie.






















Posted by [czar]
,

Howto: Git Server over SSH

Git and SSH are both powerful tools, and git/ssh work well together. We introduce how to set up git server via ssh in this post. Git server through SSH is easy and fast to set up, although every user will have access to all repositories in the git server over SSH and every user is the git administrator. This is okay for a small group of git members who trust each other. But for better privilege control, you should try gitolite or gitosis.

If you need to set up a git server for multiple users which may contain contributors and administrator, you may try gitolite as recommended by the gitolite author. A good tutorial for gitolite is here: gitolite tutorial.

If you prefer gitosis, please refer to: Setting Up a Git Server Using Gitosis and Managing Repositories on Git Server Using Gitosis. The gitosis proves quit stable from my experience, although it does not have as many features as gitolite.


In this post how to set up a basic git server and a more complex one (the git server is a server inside of a local area network) will be introduced.

A basic git server through SSH tutorial

In this part we will build up a git server through ssh connection. We use ssh to pull or push data from or to git server. The git server can be directly connected. Suppose that we set up git server on machines example.org.

Server side git user and home

logon to the git server by ssh username@example.org. username is the account name that have administrator privilege (or can sudo) on the git server.
Install git package

# yum install git

Add the user for git

# useradd -m -d /lhome/git -u 1005 git

Configure the git user’s shell

# vim /etc/passwd

Here we assume git’s home directory is /lhome/git. Then we can change git’s shell from /bin/bashto /usr/bin/git-shell to forbid logging in for a shell for the git account. It can be made by editing /etc/passwd, but this is not suggested. One good method (thanks to victor) is to use the usermod command:

# usermod -s /usr/bin/git-shell git

However, there may be problem. To make this work, the /usr/bin/git-shell should be put into/etc/shells to avoid “user ‘git’ has invalid shell, rejected” error. (Thanks to Tiago for this)

In addition, COMMAND_DIR (the path “$HOME/git-shell-commands”) must exist and any of the executables in it can be invoked. The user must have read and execute permissions to the directory in order to execute the programs in it. Hence, we should create the COMMAND_DIR in git’s home and give read and execute permission to git:

# cd /lhome/git/
# mkdir git-shell-commands
# chmod 755 git-shell-commands

Add id_rsa.pub to git’s .ssh/authorized_keys

log on to git server, using the account that have root or sudo privilege

ssh username@example.org

Copy pub key to a temp directory

# cp .ssh/id_rsa.pub /dev/shm/

operate in git’s home as root

# cd /lhome/git/.ssh

backup before changing is a good habit

# cp authorized_keys authorized_keys.bak

append pub key to git’s autorized keys list

# cat /dev/shm/id_rsa.pub >> authorized_keys

Create repository

log on example.org using the account that can edit git’s files.

If you have set the git user account’s shell to git-shell on the git server, you need to add the -s /bin/bash in the su command to use bash as the shell instead of git-shell.

Create the repository directory (as the git user on server)

# su -s /bin/bash - git
$ cd ~
$ mkdir example.git

Initial the repository, –bare means only objects is stored on server (as the git user on server)

# su -s /bin/bash - git
$ cd ~/example.git
$ git --bare init

First commit:

The first commit and push on local machine will create the initial repository.
Initialize the local repository

$ mkdir example
$ cd example
$ git init

Add a initial empty README file

$ touch README

Add README to the repository

$ git add README

Commit the changes (adding a file)

$ git commit -m 'first commit'

Add the remote git repository address

$ git remote add origin ssh://git@example.org/~/example.git

Push the commit to remote repository

$ git push origin master

When programming:

We need to clone the repository for one time:

$ git clone ssh://git@example.org/~/example.git

Then every time we want to edit some files:

$ cd example
$ git pull  # pull the newest version from the repository

After changing some files:

$ git commit -a -m 'msg'  # commit the changes with a message msg
$ git push # push the changes to the repository

A more complex git server through SSH tutorial

In this part we will build up a git server through ssh connection. We use ssh to pull or push data from or to git server. The git server is inside of a local area network. We use port forwarding to connect to it. Suppose that we set up git server on virtual machines vm111, the gateway server of the net work which vm111 is inside of is gate.example.org, and port 22111 ongate.example.org is port forwarded to vm111:22.

Server side git user and home

logon to the git server by ssh username@gate.example.org -p 22111. username is the account name that can sudo on the git server.

# yum install git
# useradd -m -d /lhome/git -u 1005 git
# vim /etc/passwd

Then change git’s shell from /bin/bash to /usr/bin/git-shell to forbid logging on for a shell for the git account. And remember to set the /etc/shells file (refer to the “basic git” section above).

Add id_rsa.pub to git’s .ssh/authorized_keys

ssh gate.example.org -p 22111  # log on to vm111, using the account that can sudo
# cp .ssh/id_rsa.pub /dev/shm/    # copy pub key to a temp directory
# su -s /bin/bash - git                        # operate in git's hom
$ cd /lhome/git/.ssh
$ cp authorized_keys authorized_keys.bak   # backup before changing is a good habit
$ cat /dev/shm/id_rsa.pub >> authorized_keys # append pub key to git's authorized keys list

Create repository

log on gate.example.org -p 22111 # using the account that can sudo

# su -s /bin/bash git
$ cd /lhome/git
$ mkdir example.git    # the repository directory
$ cd example.git
$ git --bare init      # initial the repository, --bare means only objects is stored on server

First commit:

on local laptop:

$ mkdir example
$ cd example
$ git init
$ touch README
$ git add README
$ git commit -m 'first commit'
$ git remote add origin ssh://git@gate.example.org:22111/~/example.git
$ git push origin master

When programming:

We need to clone the repository for one time:

$ git clone ssh://git@gate.example.org:22111/~/example.git

Then every time we want to edit some files:

$ cd example
$ git pull  # pull the newest version from the repository

After changing some files:

$ git commit -a -m 'msg'  # commit the changes with a message msg
$ git push # push the changes to the repository


Posted by [czar]
,

http://qiita.com/rubytomato@github/items/4be5b589d105101edfa7#%E3%82%AD%E3%83%BC%E3%81%AE%E4%BD%9C%E6%88%90


Javaアプリケーションより、Google URL Shortener APIを使用するサンプルアプリケーションです。認証にAPIキーとサービスアカウントによる2つの方法を試しました。

環境

  • Windows7 (64bit)
  • Java 1.8.0_65

参考

準備

まず、Google Developers Consoleにアクセスしてキーの作成とAPIの有効化を行います。

プロジェクトの作成

テスト用のプロジェクトを作成します。(既存にテストで使用できるプロジェクトがあればそれを使ってもかまいません)
プロジェクトを作成をクリックしプロジェクト名を入力します。

a01.png

今回はMy-API-Test Porjectとしました。
プロジェクトが作成されるとダッシュボードに移動します。

a02.png

APIの有効化

URL Shortener APIを有効化します。

a03.png

a04.png

a05.png

OAuth同意画面の設定画面

プロジェクトのOAuth同意画面の設定がまだの場合は、最初に設定を行っておく必要があります。
新規に作成したプロジェクトなので設定を行いました。サービス名に適当な名前を入力して保存します。

a07.png

キーの作成

APIキーとサービスアカウントキーを作成します。

APIキー

a08.png

名前を付けて作成するとAPIキーが発行されます。

a10.png

サービスアカウントキー

a11.png

名前を付けキーのタイプにP12を選択して作成します。
続いてキーファイルのダウンロードが始まります。

a12.png

サービスアカウントのメールアドレスを確認します。

a13.png

モザイクにしていますが、メールアドレス欄に記載されている文字列がサービスアカウントのメールアドレスです。

a14.png

アプリケーションの開発

使用するライブラリ

pom.xmlに下記の依存関係を追加します。

pom.xml
<dependency>
  <groupId>com.google.apis</groupId>
  <artifactId>google-api-services-urlshortener</artifactId>
  <version>v1-rev41-1.21.0</version>
</dependency>

resourcesフォルダの作成

src/main/resourcesフォルダを作成しここにダウンロードしたP12ファイルを配置します。

APIキーを使うサンプル

import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.urlshortener.Urlshortener;
import com.google.api.services.urlshortener.UrlshortenerRequestInitializer;
import com.google.api.services.urlshortener.model.Url;

/**
 * API KEY サンプル
 */
public class Sample2 {

  //アプリケーション名 (任意)
  private static final String APPLICATION_NAME = "urlshortener-application-example/1.0";

  private static final String API_KEY = "取得したAPIキーの値";

  public static void main(String[] args) {
    Sample2 sample = new Sample2();
    String longUrl = "http://qiita.com/rubytomato@github";

    try {
      UrlshortenerRequestInitializer initializer = sample.authorize();
      Urlshortener service = sample.getService(initializer);
      Url shortUrl = sample.getShortUrl(service, longUrl);
      //getId()値が短縮URLです
      System.out.println(shortUrl.getId());
    } catch (Exception e) {
      e.printStackTrace();
    }

  }

  private Url getShortUrl(Urlshortener service, String longUrl) throws Exception {
    System.out.println("getShortUrl in");

    Url url = new Url().setLongUrl(longUrl);
    Url result = service.url().insert(url).execute();

    return result;
  }

  private UrlshortenerRequestInitializer authorize() throws Exception {
    System.out.println("authorize in");

    return new UrlshortenerRequestInitializer(API_KEY);
  }

  private Urlshortener getService(UrlshortenerRequestInitializer initializer) throws Exception {
    System.out.println("service in");

    HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
    JsonFactory jsonFactory = new JacksonFactory();

    Urlshortener service = new Urlshortener.Builder(httpTransport, jsonFactory, null)
      .setUrlshortenerRequestInitializer(initializer)
      .setApplicationName(APPLICATION_NAME)
      .build();

    return service;
  }

}

サービスアカウントを使うサンプル

import java.io.File;
import java.util.Set;

import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.urlshortener.Urlshortener;
import com.google.api.services.urlshortener.UrlshortenerScopes;
import com.google.api.services.urlshortener.model.Url;

/**
 * サービスアカウントキー サンプル
 */
public class Sample3 {

  //アプリケーション名 (任意)
  private static final String APPLICATION_NAME = "urlshortener-application-example/1.0";

  private static final String ACCOUNT_ID = "サービスアカウントのメールアドレス";
  private static final File P12FILE = new File("src/main/resources/ダウンロードしたp12ファイル");

  //認証スコープ
  private static final Set<String> SCOPES = UrlshortenerScopes.all();

  public static void main(String[] args) {
    Sample3 sample = new Sample3();
    String longUrl = "http://qiita.com/rubytomato@github";

    try {
      Credential credential = sample.authorize();
      Urlshortener service = sample.getService(credential);
      Url shortUrl = sample.getShortUrl(service, longUrl);
      //getId()値が短縮URLです
      System.out.println(shortUrl.getId());
    } catch (Exception e) {
      e.printStackTrace();
    }

  }

  private Url getShortUrl(Urlshortener service, String longUrl) throws Exception {
    System.out.println("getShortUrl in");

    Url url = new Url().setLongUrl(longUrl);
    Url result = service.url().insert(url).execute();

    return result;
  }

  private Credential authorize() throws Exception {
    System.out.println("authorize in");

    HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
    JsonFactory jsonFactory = new JacksonFactory();

    GoogleCredential credential = new GoogleCredential.Builder()
      .setTransport(httpTransport)
      .setJsonFactory(jsonFactory)
      .setServiceAccountId(ACCOUNT_ID)
      .setServiceAccountPrivateKeyFromP12File(P12FILE)
      .setServiceAccountScopes(SCOPES)
      .build();

    boolean ret = credential.refreshToken();
    System.out.println("refreshToken:" + ret);

    // debug dump
    if (credential != null) {
      String accessToken = credential.getAccessToken();
      Long expires = credential.getExpiresInSeconds();
      System.out.println("AccessToken:" + accessToken);
      System.out.println("expires:" + expires);
    }

    return credential;
  }

  /**
   * 保存していたアクセストークンからcredentialを生成することができます 
   */
  private GoogleCredential makeCredential(String accessToken) {
    System.out.println("makeCredential in");

    GoogleCredential credential = new GoogleCredential().setAccessToken(accessToken);

    if (credential != null) {
      accessToken = credential.getAccessToken();
      Long expires = credential.getExpiresInSeconds();
      System.out.println("AccessToken:" + accessToken);
      System.out.println("expires:" + expires);
    }

    return credential;
  }

  private Urlshortener getService(Credential credential) throws Exception {
    System.out.println("service in");

    HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
    JsonFactory jsonFactory = new JacksonFactory();

    Urlshortener service = new Urlshortener.Builder(httpTransport, jsonFactory, credential)
    .setApplicationName(APPLICATION_NAME)
    .build();

    return service;
  }

}


Posted by [czar]
,


Language Plural Rules





http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html


Language NameCodeCategoryExamplesRules
Englishenone1one → n is 1;
other → everything else
other0, 2-999;
1.2, 2.07...



Language NameCodeCategoryExamplesRules
Koreankoother0-999;
1.2...
other → everyth



안드로이드 plurals 설정할때 참고용

영어표시할때 zero는 안됨.


if (commentsCount == 0)
    str = res.getString(R.string.number_of_comments_zero);
else
    str = res.getQuantityString(R.plurals.number_of_comments, commentsCount, commentsCount);

이런식으로 count 확인해서 따로 해야함.


한글은 other만 지원함.

Posted by [czar]
,

awststs html 수정


/usr/local/awstats/wwwroot/cgi-bin


awstats.pl 에서

이번달 접속통계 테이블 수정하기



13770 라인부터 확인





         # Show data array for days
         if ($AddDataArrayShowDaysOfMonthStats) {
                 print "<table>\n";
                 print
 "<tr><td width=\"110\" bgcolor=\"#$color_TableBGRowTitle\">$Message[4]</td>";
                 if ( $ShowDaysOfMonthStats =~ /V/i ) {
                         print "<td width=\"100\" bgcolor=\"#$color_v\""
                           . Tooltip(1)
                           . ">$Message[10]</td>";
                 }
                 if ( $ShowDaysOfMonthStats =~ /P/i ) {
                         print "<td width=\"80\" bgcolor=\"#$color_p\""
                           . Tooltip(3)
                           . ">$Message[56]</td>";
                 }
                 if ( $ShowDaysOfMonthStats =~ /H/i ) {
                         print "<td width=\"80\" bgcolor=\"#$color_h\""
                           . Tooltip(4)
                           . ">$Message[57]</td>";
                 }
                 if ( $ShowDaysOfMonthStats =~ /B/i ) {
                         print "<td width=\"101\" bgcolor=\"#$color_k\""
                           . Tooltip(5)
                           . ">$Message[75]</td>";
                 }


80으로 되어 있던걸 원하는 사이즈로 수정

잘나옴.


Posted by [czar]
,
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum -y install libpcap libpcap-devel libnet libnet-devel pcre pcre-devel gcc gcc-c++ automake autoconf libtool make libyaml libyaml-devel zlib zlib-devel file-devel


md5용

yum install nss-util nss-util-devel nss-devel nspr-devel nspr


geoip용


yum install GeoIP-devel GeoIP


Posted by [czar]
,

https://www.scalescale.com/tips/nginx/how-to-install-nginx-geoip-module/


Nginx GeoIP module for country and city geo targeting can be installed in a few easy steps. It brings you a geo targeting layer allowing you to show some parts of your websites, or even split traffic according to the geographical location of the end users.

Requirements for CentOS/Fedora/RHEL

yum install zlib-devel -y

Install MaxMind C API

cd /tmp
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
tar -zxvf GeoIP.tar.gz
cd GeoIP-1.4.8
./configure
make
make install

Index the library into the system with ldconfig

echo '/usr/local/lib' > /etc/ld.so.conf.d/geoip.conf
ldconfig

Check that the library is loaded ok:

ldconfig -v | grep GeoIP

if you see something like this:

libGeoIPUpdate.so.0 -> libGeoIPUpdate.so.0.0.0
libGeoIP.so.1 -> libGeoIP.so.1.4.8

That means the library was installed sucessfully.

Compile Nginx GeoIP module

Download Nginx latest stable version and add –with-http_geoip_module to your ./configure options, example:

./configure --with-http_geoip_module

Output:

wget http://nginx.org/download/nginx-1.4.3.tar.gz
tar -xvpzf nginx-1.4.3.tar.gz
cd nginx-1.4.3/
./configure --with-http_geoip_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6

Install MaxMind GeoCity and GeoCountry Databases

mkdir -p /usr/local/share/GeoIP/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz -O /usr/local/share/GeoIP/GeoLiteCity.dat.gz
gzip -d /usr/local/share/GeoIP/GeoLiteCity.dat.gz

Get the free database of geo_country:

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz -O /usr/local/share/GeoIP/GeoIP.dat.gz
gzip -d /usr/local/share/GeoIP/GeoIP.dat.gz

Add this to nginx.conf file:

# SET the path to the .dat file used for determining the visitor's country from the IP-address ###
geoip_country /usr/local/share/GeoIP/GeoIP.dat;

# SET the path to the .dat file used for determining the visitor's country from the IP-address ###
geoip_city /usr/local/share/GeoIP/GeoLiteCity.dat;

Configuring GeoIP variables

If you are using nginx with php-fpm, place this variables inside http block:

# 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;

If you use nginx as proxy for apache, use this block:

# Set proxy geoip variables
proxy_set_header GEOIP_COUNTRY_CODE $geoip_country_code;
proxy_set_header GEOIP_COUNTRY_CODE3 $geoip_country_code3;
proxy_set_header GEOIP_COUNTRY_NAME $geoip_country_name;
proxy_set_header GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
proxy_set_header GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
proxy_set_header GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
proxy_set_header GEOIP_REGION $geoip_region;
proxy_set_header GEOIP_CITY $geoip_city;
proxy_set_header GEOIP_POSTAL_CODE $geoip_postal_code;
proxy_set_header GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
proxy_set_header GEOIP_LATITUDE $geoip_latitude;
proxy_set_header GEOIP_LONGITUDE $geoip_longitude;

Testing GeoIP module

Let’s create a simple PHP test to find out the output of the variables:

<html>
<body>
<?php

$geoip_country_code = getenv(GEOIP_COUNTRY_CODE);
/*
$geoip_country_code = $_SERVER['GEOIP_COUNTRY_CODE']; // works as well
*/
$geoip_country_code3 = getenv(GEOIP_COUNTRY_CODE3);
$geoip_country_name = getenv(GEOIP_COUNTRY_NAME);

$geoip_city_country_code = getenv(GEOIP_CITY_COUNTRY_CODE);
$geoip_city_country_code3 = getenv(GEOIP_CITY_COUNTRY_CODE3);
$geoip_city_country_name = getenv(GEOIP_CITY_COUNTRY_NAME);
$geoip_region = getenv(GEOIP_REGION);
$geoip_city = getenv(GEOIP_CITY);
$geoip_postal_code = getenv(GEOIP_POSTAL_CODE);
$geoip_city_continent_code = getenv(GEOIP_CITY_CONTINENT_CODE);
$geoip_latitude = getenv(GEOIP_LATITUDE);
$geoip_longitude = getenv(GEOIP_LONGITUDE);

echo 'country_code: '.$geoip_country_code.'<br>';
echo 'country_code3: '.$geoip_country_code3.'<br>';
echo 'country_name: '.$geoip_country_name.'<br>';

echo 'city_country_code: '.$geoip_city_country_code.'<br>';
echo 'city_country_code3: '.$geoip_city_country_code3.'<br>';
echo 'city_country_name: '.$geoip_city_country_name.'<br>';
echo 'region: '.$geoip_region.'<br>';
echo 'city: '.$geoip_city.'<br>';
echo 'postal_code: '.$geoip_postal_code.'<br>';
echo 'city_continent_code: '.$geoip_city_continent_code.'<br>';
echo 'latitude: '.$geoip_latitude.'<br>';
echo 'longitude: '.$geoip_longitude.'<br>';

?>
</body>
</html>

Apply the changes:

service nginx restart

Read more about Nginx GeoIP module: http://wiki.nginx.org/HttpGeoipModule

Posted by [czar]
,