Welcome! Log In Create A New Profile

Advanced

nginx, GeoIP and nodejs setup for virtual hosts?

February 18, 2011 09:47AM
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
Subject Author Posted

nginx, GeoIP and nodejs setup for virtual hosts?

khine February 18, 2011 09:47AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 69
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready