Tornado生产环境部署

以下是我之前部署《基于Tornado的微信小程序订单系统》中nginx的配置文件,更详细地如何使用Tornado+Nginx+Supervisor部署生产环境,请参考文章部署Tornado

# nginx.conf
worker_processes 1;

events {
    worker_connections 1024;
    use epoll;
}

http {

    upstream tornadoes {
        server 127.0.0.1:8000;
        server 127.0.0.1:8001;
        server 127.0.0.1:8002;
        server 127.0.0.1:8003;
    }


    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  30;

    server {
        listen 80;
        server_name 127.0.0.1;

        location /static {
            alias /root/myproject/miniorder/static;
            }

        location / {
            proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_pass http://tornadoes;
        }
    }
}

你可能感兴趣的:(Tornado生产环境部署)