centos 6.7 搭建tornado + nginx + supervisor的方法(已经实践)
首先,本来不想写这篇博客了,但是我测试了很多网上的例子包括简书的,全不行,我总结原因是自己太笨,搞了俩个晚上,后来决定,自己还是写一篇记录下来,保证自己以后使用
环境:
centos6.7 64
python2.7.11
pip 9.0.1
nginx1.4.5
1.安装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的方法(已经实践)的更多相关文章
- tornado nginx supervisor
安装:sudo apt-get install python-tornado sudo apt-get install nginx sudo apt-get install supervisor 1. ...
- 搭建Tornado+Nginx
Tornado一个高效的异步非阻塞式的实时Web服务器,是Facebook旗下的 FriendFeed 网站开源Web服务器版本.但是它内置的HTTP服务器功能有限,不能在生产环境下使用. 在 Fri ...
- centos ftp服务器搭建 vsftpd 匿名访问配置方法 ftp 550 Failed to open file 错误处理
vsftpd是linux下常用的ftp服务软件,配置起来其实不复杂,只是网上很多文章,配置后都无法成功.我使用它是用于局域网内部分享文件的,所以使用匿名的方式. ftp本身密码是明文传输的,如果需要安 ...
- CentOS,net core2 sdk nginx、supervisor、mysql
CentOS下 .net core2 sdk nginx.supervisor.mysql环境搭建 作为.neter,看到.net core 2.0的正式发布,心里是有点小激动的,迫不及待的体验了一把 ...
- 在CentOS 6上搭建私有的Docker Registry
在CentOS 6上搭建私有的Docker Registry v2Registry概念 :Registry是一个无状态的, 高可扩展的服务器端应用程序, 用于存储和分发Docker Image. 依赖 ...
- CentOS 6.5 搭建 Zabbix
CentOS 6.5 搭建 Zabbix 说明: 操作系统:CentOS 6.5 IP地址:192.168.21.127 Web环境:Nginx+MySQL+PHP zabbix版本:Zabbix 2 ...
- asp.net core 二 Nginx Supervisor 负载,监听
ASP.NET Core负载均衡集群搭建(CentOS7+Nginx+Supervisor+Kestrel) asp.net core在linux运行下,一但命令行退出 ...
- Linux+Nginx+Supervisor部署ASP.NET Core实操手册
一.课程介绍 在上一节课程<ASP.NET Core托管和部署Linux实操演练手册>中我们学过net core的部署方式多样性和灵活性.我们通过远程工具输入dotnet 程序集名称.dl ...
- Centos vsftpd服务器搭建
Centos vsftpd服务器搭建 时间:2016-07-18 1.最为简单的vsftpd服务器搭建 1.安装vsftpd 1.yum 安装 yum install vsftpd 2.rpm文件安装 ...
随机推荐
- [LeetCode] Search Insert Position 搜索插入位置
Given a sorted array and a target value, return the index if the target is found. If not, return the ...
- [LeetCode] Longest Valid Parentheses 最长有效括号
Given a string containing just the characters '(' and ')', find the length of the longest valid (wel ...
- 【三石视频教程】当FineUIPro遇到ReportViewer
FineUIPro 下个版本(v2.8.0)即将支持 ReportViewer,为此三石特别制作了一期视频教程,供大家参考. 运行效果图: 视频下载:http://pan.baidu.com/s/ ...
- NPOI操作EXCEL(五)——含合并单元格复杂表头的EXCEL解析
我们在第三篇文章中谈到了那些非常反人类的excel模板,博主为了养家糊口,也玩命做出了相应的解析方法... 我们先来看看第一类复杂表头: ...... 博主称这类excel模板为略复杂表头模板(蓝色部 ...
- ASP.NET MVC VS2010中更改默认调试浏览器
在Visual Studio 2010(RC)中右键点击 .aspx 页面已不复存在"browse with"菜单项.那要如何修改调试时使用的默认浏览器呢? 默认情况下,VS会使用 ...
- modelsim实用教程--前言
前言 Modelsim是一款专业的仿真软件,特别是在Quartus II 11.0之后的版本,都没有配套自身的仿真软件,所以Modelsim成了在FPGA设计流程中的进行功能仿真的首选仿真软件之一. ...
- 使用UITableView的分组样式
分组样式顾名思义是对TableView中的数据行进行分组处理,每个分组都有一个header和footer. TableView中header的英文文本是大写的,footer的英文文本是小写的.如下图浅 ...
- 【CodeVS 1288】埃及分数
http://codevs.cn/problem/1288/ loli秘制面向高一的搜索,好难啊QAQ 我本来想按照分母从大到小搜,因为这样分母从小到大枚举到的第一个可行方案就是最优方案. 但貌似会T ...
- 如何做好PMO,PMO分哪些方面?
谢邀! 理论的东西,中国PMO大会的帐号说的很全面了. 我分享一些个人感受.失败经验: 我曾帮助中国区COO创立过PMO并且运营两年,COO离职后终止. 成功案例: 我曾看过总部老大们设立Busine ...
- 【转】JAVA自学之路
JAVA自学之路 一: 学会选择 为了就业,不少同学参加各种各样的培训. 决心做软件的,大多数人选的是java,或是.net,也有一些选择了手机.嵌入式.游戏.3G.测试等. 那么究竟应该选择什么方向 ...