zoukankan      html  css  js  c++  java
  • web(一)----tornado nginx配置

    参考 http://www.luokr.com/p/2

    上一节安装了tornado,  本节安装ngix, Nginx来将web请求代理到Tornado web server

     

    一.  首先安装Nginx.

    1. $ rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
    2. $ yum install nginx

    二. 接下来是Nginx的配置.

    1. 新建配置文件$ vim /etc/nginx/conf.d/tornado.conf  (默认配置文件是/etc/nginx/sites-available/default)  
    2. 输入如下内容:
    upstream tornado {
        server 127.0.0.1:8888;
    }
     
    server {
        listen   80;
        root /var/www;
        index index.py index.html;
     
        server_name server;
     
        location / {
    root /var/www; if (!-e $request_filename) { rewrite ^/(.*)$ /index.py/$1 last; } } location ~ /index.py { proxy_pass_header Server; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_pass http://tornado; } }

    三. 重启Nginx.     

     $ service nginx restart 

    四. 通过http://localhost访问. 

    注意:

    (1)其中的root /var/www是index.py所在的文件夹.

    (2)http://localhost  访问

    (3)如果访问http://localhost/template        则index.py中为(r"/index.py/template", TemplateHandler)

  • 相关阅读:
    JS分页条插件
    C#Lambda
    常用CSS样式速查
    简易表格编辑器
    使用template
    js 时间类函数
    数据库表增删查改帮助类
    使用github
    box-shadow属性
    box-sizing属性
  • 原文地址:https://www.cnblogs.com/helloweworld/p/4123305.html
Copyright © 2011-2022 走看看