# Nginx, GeoIP and nodejs setup for virtual hosts?

**URL:** <https://www.ruby-forum.com/t/nginx-geoip-and-nodejs-setup-for-virtual-hosts/203368>\
**Category:** NGINX\
**Created:** [February 18, 2011, 3:49pm UTC](https://www.ruby-forum.com/t/nginx-geoip-and-nodejs-setup-for-virtual-hosts/203368 "2011-02-18T15:49:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 18, 2011, 3:49pm UTC](https://www.ruby-forum.com/t/nginx-geoip-and-nodejs-setup-for-virtual-hosts/203368/1 "2011-02-18T15:49:29Z")

</div>

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](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.

```auto
#!/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)

```

thanks

Posted at Nginx Forum:

> **[nginx, GeoIP and nodejs setup for virtual hosts?](https://forum.nginx.org/read.php?2,176479,176479#msg-176479)**
>
> 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...
