【发布时间】:2015-04-22 06:18:27
【问题描述】:
这是我第一次使用nginx
我写了一个简单的python/tornado代码如下,当我使用python server.py时,我可以看到index.html页面。
from tornado.options import define, options
from db import MongoImpl
define("port", default=8000, help="run on the given port", type=int)
class IndexHandler(tornado.web.RequestHandler):
def get(self):
self.render("./pages/index.html")
app = tornado.web.Application([(r'/', IndexHandler)],
debug=True)
app.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
然后我开始配置 nginx.conf,我在默认的 nginx.conf 中添加了以下内容:
http {
server{
listen 8000;
root /home/ubuntu/work/mytornado/pages;
index index.html index.htm;
}
然后我nginx -s reload
但是,当我使用http://myipaddress 时,我只看到 nginx 欢迎页面,而不是我的索引 html....
有什么问题吗?
【问题讨论】: