Welcome! Log In Create A New Profile


nginx, GeoIP and nodejs setup for virtual hosts?

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


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: 236
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready