# !/usr/bin/python # -*- coding: utf-8 -*- from tornado import web,ioloop class IndexHandler(web.RequestHandler): def get(self): ip = self.request.remote_ip self.write(ip) handlers = [ (r'/', IndexHandler), ] settings = dict( debug = True, ) app = web.Application(handlers, **settings) app.listen(8000) ioloop.IOLoop.instance().start() http { upstream example.server.com { server 127.0.0.1:8000; } se