首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

生产环境上部署Tornado+Supervisor

2012-12-25 
生产环境下部署Tornado+Supervisor1、安装supervisoreasy_install supervisor2、配置supervisorecho_supervi

生产环境下部署Tornado+Supervisor
1、安装supervisor
easy_install supervisor

2、配置supervisor
echo_supervisord_conf > /etc/supervisord.conf
vim /etc/supervisord.conf
-------------------------------------------------------
[program:tornado_app]
command=python tornado_app.py 80%(process_num)02d
process_name=%(program_name)s_(process_num)02d
umask=022
startsecs=0
stopwaitsecs=0
redirect_stderr=true
stdout_logfile=/tmp/codoon.log
numprocs=4
numprocs_start=1
--------------------
3、重启supervisor
supervisord
supervisorctl reload
查看supervisord和tornado的运行情况:
ps aux

4、配置nignx
--------------------
upstream frontends {      
  server 127.0.0.1:8001;      
  server 127.0.0.1:8002;      
  server 127.0.0.1:8003;      
  server 127.0.0.1:8004;
}
location / {                        
  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://frontends;                        
  proxy_next_upstream error;
}
--------------------
保存配置文件后执行  让nginx重启的指令 nginx -s reload

热点排行