nginx, GeoIP and nodejs setup for virtual hosts?
khine
nginx-forum at nginx.us
Fri Feb 18 17:47:39 MSK 2011
hello,
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=74.125.230.84&host=nginx.local 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.
[code]
#!/usr/bin/python2.6
# -*- coding: utf-8 -*-
import twill.commands
import csv
from time import sleep
a=twill.commands
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:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14")
reader = csv.reader(open("ips.csv"))
for host, ip in reader:
url='http://aqoon.local:10080/stat?ip=%s&title=%s' % (ip, host)
b.go(url)
sleep(5)
[/code]
thanks
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,176479,176479#msg-176479
More information about the nginx
mailing list