tornado之supervisor nginx部署
来源:互联网 发布:医院网络拓扑结构图 编辑:程序博客网 时间:2024/05/29 00:34
tornado之supervisor nginx部署
- 本文主要介绍tornado基于supervisor和nginx的部署问题
nginx tornado反向代理配置
- 部署的模型图如下
supervisor安装
- supervisor入门地址
http://blog.csdn.net/ricky110/article/details/77430387
- 配置(新建tornado.conf)
[group:tornadoes]programs=tornado-7000,tornado-7001,tornado-7002,tornado-7003[program:tornado-7000]command=python /home/wuyong/tornado_learn/hello_module.py --port=7000directory=/var/wwwuser=www-dataautorestart=trueredirect_stderr=truestdout_logfile=/var/log/tornado.logloglevel=info[program:tornado-7001]command=python /home/wuyong/tornado_learn/hello_module.py --port=7001directory=/var/wwwuser=www-dataautorestart=trueredirect_stderr=truestdout_logfile=/var/log/tornado.logloglevel=info[program:tornado-7002]command=python /home/wuyong/tornado_learn/hello_module.py --port=7002directory=/var/wwwuser=www-dataautorestart=trueredirect_stderr=truestdout_logfile=/var/log/tornado.logloglevel=info[program:tornado-7003]command=python /home/wuyong/tornado_learn/hello_module.py --port=7003directory=/var/wwwuser=www-dataautorestart=trueredirect_stderr=truestdout_logfile=/var/log/tornado.logloglevel=info
- 修改supervisor的inet_http_server
- 被测试的服务脚本
import tornado.webfrom tornado.options import define, optionsdefine("port", default=8000, help="run on the given port", type=int)class IndexHandler(tornado.web.RequestHandler): def get(self): greeting = self.get_argument('greeting', 'Hello') self.write(greeting + ', friendly user!')if __name__ == "__main__": tornado.options.parse_command_line() app = tornado.web.Application(handlers=[(r"/", IndexHandler)]) http_server = tornado.httpserver.HTTPServer(app) http_server.listen(options.port) tornado.ioloop.IOLoop.instance().start()
- 测试验证supervisor是否正确
- 页面测试
以上说明验证成功
nginx搭建
nginx安装 apt-get install nginx
修改配置 cd /etc/nginx && vim tornado_nginx.conf加入以下配置,将后端上游服务upstream指定好
proxy_next_upstream error;upstream tornadoes { server 127.0.0.1:7000; server 127.0.0.1:7001; server 127.0.0.1:7002; server 127.0.0.1:7003;}server { listen 81; 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; }}
运行
/usr/sbin/nginx验证成功,查看日志及页面访问
https
- nginx ssl解密配置
server { listen 443; ssl on; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/cert.key; default_type application/octet-stream; location /static/ { root /var/www/static; if ($query_string) { expires max; } } location = /favicon.ico { rewrite (.*) /static/favicon.ico; } 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; }}
- nginx 转发http到https请求
server { listen 80; server_name example.com; rewrite /(.*) https://$http_host/$1 redirect;}
阅读全文
0 0
- tornado之supervisor nginx部署
- python+Tornado + Supervisor + nginx部署
- python+Tornado + Supervisor + nginx部署
- python+Tornado + Supervisor + nginx部署
- ubuntu+nginx+supervisor部署tornado
- python+Tornado + Supervisor + nginx部署
- 部署项目Nginx+Tornado+Supervisor
- ubuntu下python+tornado+supervisor+nginx部署
- nginx+supervisor+tornado
- tornado nginx supervisor
- Tornado+nginx+supervisor 在生产环境上部署
- Tornado + supervisor + nginx 环境部署与初体验
- Supervisor + Tornado 之吐槽
- ubuntu16.04 nginx 部署 tornado
- tornado+celery+flower+supervisor部署的简化操作
- tornado 使用supervisor管理进程,使用nginx做负载均衡
- django+nginx+supervisor+gunicorn+gevent 网站部署
- python web 部署:nginx + gunicorn + supervisor + flask
- kubelet代码整理
- 除了跨平台和平台成本以外,Java 还有什么特性是 C# 不具备的?
- 用电路做加法
- JS基础梳理
- 一个粗糙的二人贪吃蛇联机版实现
- tornado之supervisor nginx部署
- HTML Imports
- 数组对象排序
- 基于Struts2和hibernate的WebSocket聊天室的实现教程二:发送在线列表
- Linux文件权限
- Win 10更新MinGW
- 藏锋少年与边界诱惑
- 是时候放弃MySQL的五大理由
- OpenGL学习日记1_创建窗口