JEFFREY

feiworks.com

生产环境部署Supervisor与Tornado

1、安装supervisor

easy_install supervisor

2、配置supervisor

echo_supervisord_conf > /etc/supervisord.conf
vim /etc/supervisord.conf
[program:jfweb]
command=python /home/www/server/web.py -port=81%(process_num)02d
process_name=%(program_name)s_%(process_num)02d
autostart=true
autorestart=true
numprocs=16
numprocs_start=1
[program:jfweb_admin]
command=python /home/www/server/admin_web.py
process_name=%(program_name)s
autostart=true

3、重启supervisor

supervisord
supervisorctl reload

4、配置nignx

upstream frontends {
        server 127.0.0.1:8101;
        server 127.0.0.1:8102;
        server 127.0.0.1:8103;
        server 127.0.0.1:8104;
        server 127.0.0.1:8105;
        server 127.0.0.1:8106;
        server 127.0.0.1:8107;
        server 127.0.0.1:8108;
        server 127.0.0.1:8109;
        server 127.0.0.1:8110;
        server 127.0.0.1:8111;
        server 127.0.0.1:8112;
        server 127.0.0.1:8113;
        server 127.0.0.1:8114;
        server 127.0.0.1:8115;
        server 127.0.0.1:8116;
}
proxy_next_upstream error;

        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://frontends;
        }


保存配置文件后执行  让nginx重启的指令 nginx -s reload

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Z-BlogPHP 1.5 Zero

Copyright @ 2014-2019 All Rights Reserved.
feiworks.com