首先,本来不想写这篇博客了,但是我测试了很多网上的例子包括简书的,全不行,我总结原因是自己太笨,搞了俩个晚上,后来决定,自己还是写一篇记录下来,保证自己以后使用

环境:

  centos6.7 64

  python2.7.11

  pip 9.0.1

  nginx1.4.5

1.安装nginx

nginx安装方法

[root@pythonS1 ~]# vim /usr/local/nginx1.4.5/conf/nginx.conf
user nginx;
worker_processes ; events {
worker_connections ;
use epoll;
} http{
upstream tornadoes {
server 127.0.0.1:;
server 127.0.0.1:;
server 127.0.0.1:;
server 127.0.0.1:;
} server {
listen ;
server_name localhost; location /static/ {
root /var/www/static;
if ($query_string) {
expires max;
}
} 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;
#proxy_pass http://www.iyunv.com/;
}
}
}

2.tornado的代码

我把自己的代码放在了/opt/pythonweb下面

3.supervisor安装和使用

启动supervisor的时候报错pkg_resources.DistributionNotFound: meld3>=0.6.5

Traceback (most recent call last):
File "/usr/bin/echo_supervisord_conf", line , in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line , in <module>
File "/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line , in require
File "/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line , in resolve
pkg_resources.DistributionNotFound: meld3>=0.6.

解决方法:pip安装的meld3不可用,手动安装。

wget https://pypi.python.org/packages/source/m/meld3/meld3-1.0.2.tar.gz
tar -zxf meld3-1.0..tar.gz
cd meld3-1.0.
python setup.py install

生成配置文件

echo_supervisord_conf > /etc/supervisord.conf

配置文件最后添加的内容,注意没有user会报错的

启动服务

/usr/local/nginx1.4.5/sbin/nginx

supervisorctl

start all

4.监控多个进程服务,监控nginx, celery等

[program:python]
command=python /opt/pythonweb/hello.py
directory=/opt/pythonweb
autostart=true ; start at supervisord start (default: true)
startretries= ; max # of serial start failures when starting (default )
autorestart=true ; when to restart if exited after running (def: unexpected)
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/nginx.log ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups= ; # of stdout logfile backups (default )
stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default )
stdout_events_enabled=false ; emit events on stdout writes (default false)
stderr_logfile=/var/log/nginx_err.log ; stderr log path, NONE for none; default AUTO
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
stderr_logfile_backups= ; # of stderr logfile backups (default )
stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default )
stderr_events_enabled=false ; emit events on stderr writes (default false)
user=root
supervisorctl start nginx  # 启动 nginx
supervisorctl start all # 启动所有进程
supervisorctl status # 查看进程状态

5.注意每次更新完supervisor以后一定要重启supervisor,ps -ef | grep supervisor ,,,kill

centos 6.7 搭建tornado + nginx + supervisor的方法(已经实践)的更多相关文章

  1. tornado nginx supervisor

    安装:sudo apt-get install python-tornado sudo apt-get install nginx sudo apt-get install supervisor 1. ...

  2. 搭建Tornado+Nginx

    Tornado一个高效的异步非阻塞式的实时Web服务器,是Facebook旗下的 FriendFeed 网站开源Web服务器版本.但是它内置的HTTP服务器功能有限,不能在生产环境下使用. 在 Fri ...

  3. centos ftp服务器搭建 vsftpd 匿名访问配置方法 ftp 550 Failed to open file 错误处理

    vsftpd是linux下常用的ftp服务软件,配置起来其实不复杂,只是网上很多文章,配置后都无法成功.我使用它是用于局域网内部分享文件的,所以使用匿名的方式. ftp本身密码是明文传输的,如果需要安 ...

  4. CentOS,net core2 sdk nginx、supervisor、mysql

    CentOS下 .net core2 sdk nginx.supervisor.mysql环境搭建 作为.neter,看到.net core 2.0的正式发布,心里是有点小激动的,迫不及待的体验了一把 ...

  5. 在CentOS 6上搭建私有的Docker Registry

    在CentOS 6上搭建私有的Docker Registry v2Registry概念 :Registry是一个无状态的, 高可扩展的服务器端应用程序, 用于存储和分发Docker Image. 依赖 ...

  6. CentOS 6.5 搭建 Zabbix

    CentOS 6.5 搭建 Zabbix 说明: 操作系统:CentOS 6.5 IP地址:192.168.21.127 Web环境:Nginx+MySQL+PHP zabbix版本:Zabbix 2 ...

  7. asp.net core 二 Nginx Supervisor 负载,监听

           ASP.NET Core负载均衡集群搭建(CentOS7+Nginx+Supervisor+Kestrel)          asp.net core在linux运行下,一但命令行退出 ...

  8. Linux+Nginx+Supervisor部署ASP.NET Core实操手册

    一.课程介绍 在上一节课程<ASP.NET Core托管和部署Linux实操演练手册>中我们学过net core的部署方式多样性和灵活性.我们通过远程工具输入dotnet 程序集名称.dl ...

  9. Centos vsftpd服务器搭建

    Centos vsftpd服务器搭建 时间:2016-07-18 1.最为简单的vsftpd服务器搭建 1.安装vsftpd 1.yum 安装 yum install vsftpd 2.rpm文件安装 ...

随机推荐

  1. ElasticSearch第二步-CRUD之Sense

    ElasticSearch系列学习 ElasticSearch第一步-环境配置 ElasticSearch第二步-CRUD之Sense ElasticSearch第三步-中文分词 ElasticSea ...

  2. 《MySQL 必知必会》读书总结

    这是 <MySQL 必知必会> 的读书总结.也是自己整理的常用操作的参考手册. 使用 MySQL 连接到 MySQL shell>mysql -u root -p Enter pas ...

  3. css:子元素div 上下左右居中方法总结

    最近在面试,不停地收到了知识冲击,尤其是对于一些基础的css.html.js问题居多,所以自我也在做反思,今天就css问题,如何让一个子元素div块元素上下左右居中 (以下总结方法,都已得到验证). ...

  4. MSSQLSERVER

    create database test--创建数据库zh use test --打开数据库 go--执行 create table tab--创建表 ( UserName ),--创建字符串类型的字 ...

  5. Angularjs+node+Mysql实现地图上的多点标注

    注:本文适合对于node有一定基础的人,如果您是小白,请先用1个小时学习node.node文档https://nodejs.org/en/docs/ 该片博文的源码地址:https://github. ...

  6. 使用charles V3.11.2 实现SSL抓包

    首先,确认开启了SSL选项: 然后到Help->SSL Proxying里查看帮助; 根据提示,将android手机连接到局域网的wifi上,然后将wifi连接的代理设置为192.168.21. ...

  7. HTML5学习总结-番外04 Cordova/PhoneGap

    一 PhoneGap 1 PhoneGap简绍 http://www.cnblogs.com/JustRun1983/p/3819433.html 2 环境安装 http://cordova.apac ...

  8. php实现数据粘性例子

    php实现数据粘性例子 在填表单的时候,有时候会出现表单未填完就提交的情况,这时候若是想要回到原来的表单页面,一般之前填的内容都会消失掉. 故使用PHP实现回到原来表单但是填写数据不消失,代码

  9. 借助Html制作渐变的网页背景颜色

    借助Html制作渐变的网页背景颜色 <html> <head> <title>制作渐变背景</title> <meta http-equiv=&q ...

  10. 机器学习——支持向量机(SVM)之Platt SMO算法

    Platt SMO算法是通过一个外循环来选择第一个alpha值的,并且其选择过程会在两种方式之间进行交替: 一种方式是在所有数据集上进行单遍扫描,另一种方式则是在非边界alpha中实现单遍扫描. 所谓 ...