nginx, GeoIP and nodejs setup for virtual hosts?

khine nginx-forum at
Fri Feb 18 17:47:39 MSK 2011

i have setup nodejs server to run on port 10080, running a demo
'livestats' application, i also have nginx running on port 80.

the nodejs application simply listens for requests like
http://nodejs.local:10080/stat?ip= and
then creates an icon on a map that displays from which country the IP is
registered to and displays the domain name that accessed it.

what will be the correct way to configure nginx so that for each vhost
server { } block i can pass the IP address and the server name to the
nodejs application?

for now i have a simple python script, that just parses the IP address
from a csv file, but i would like to know how to do this directly from
nginx for each server block.

# -*- coding: utf-8 -*-

import twill.commands
import csv
from time import sleep

a.config("readonly_controls_writeable", 1)
b = a.get_browser()
b.set_agent_string("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
rv: Gecko/20080404 Firefox/")

reader = csv.reader(open("ips.csv"))
for host, ip in reader:
    url='http://aqoon.local:10080/stat?ip=%s&title=%s' % (ip, host)



Posted at Nginx Forum:,176479,176479#msg-176479

More information about the nginx mailing list