django+nginx+supervisor+gunicorn+gevent 网站部署
2015-01-20 09:56
537 查看
django+nginx+supervisor+gunicorn+gevent 网站部署
django,nginx,supervisor,gunicorn,gevent这几个都是在本领域大名鼎鼎的软件,下面的部署都是在ubuntu12.04里面验证成功的!首先是安装这些软件在ubuntu下面都比较简单,nginx和supservisor的安装如下apt-get install nginx,supervisor在ubuntu下使用python,强烈建议安装python-dev
apt-get install python-dev
安装django,gunicorn,gevent,使用虚拟环境安装,不要污染了系统库
配置gunicorn
gunicorn app.wsgi:application -w 4 -b :%(proxy_port)s -k gevent --max-requests 500 --access-logfile=%(access_log)s --error-logfile=%(error_log)s这个是一个基本的运行配置,不过对于大多数网站来说已经够用了
supervisor配置
[program:dyzww] autorestart=true command= 这里写上面gunicorn 的command directory= 网站所在的目录 process_name= top 中显示的进程名 redirect_stderr=true stdot_logfile=log文件
nginx配置
server { listen 80 default; server_name _; default_type application/octet-stream; gzip on; gzip_http_version 1.0; gzip_proxied any; gzip_min_length 500; gzip_disable "MSIE [1-6]\."; gzip_types text/plain text/html text/xml text/css text/comma-separated-values text/javascript application/x-javascript application/atom+xml image/jpeg image/gif image/png; location /static/ { alias 静态文件目录,后面的斜杠必须要/; } location /media/ { alias 媒体文件目录,后面斜杠必须有/; expires 30d; } location / { try_files $uri @proxied; } location @proxied { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass 这里填写gunicorn监听的地址; } access_log log文件; }
按照上面的配置,django网站就能够驱动起来了,静态文件全部由nginx处理,只有动态文件需要django处理,这样大大的增加了性能!小站易读中文网就是这么驱动的,上面的代码全部从服务器中copy过来! 在这里也给小站打个广告 http://www.ydzww.com ,本文来自:Linux学习网
相关文章推荐
- django+nginx+supervisor+gunicorn+gevent 网站部署
- django+nginx+supervisor+gunicorn+gevent 网站部署
- django+nginx+supervisor+gunicorn+gevent 网站部署
- django+nginx+supervisor+gunicorn+gevent 网站部署
- 网站部署过程 Nginx + Gunicorn +Supervisor +Flask
- Flask Nginx Gunicorn Supervisor 网站部署 详解
- 阿里云部署Django项目(超详细图文教程) —— Part2. 使用Nginx, Gunicorn, virtualenv, supervisor 部署Django应用
- 阿里云ESC网站部署Flask+gunicorn+nginx+supervisor
- 给我一台全新的服务器,使用nginx+gunicorn+supervisor部署django
- Django笔记 生产环境部署 gunicorn+nginx+supervisor
- nginx+django+gunicorn+gevent+supervisor
- Ubuntu 部署Django, Wagtail,Postgres, Nginx, Gunicorn,Supervisor
- Flask+Gunicorn+Gevent+Supervisor+Nginx生产环境部署
- nginx、gunicorn、supervisor三个来共同协作搭建网站出现问题
- nginx + gunicorn + virtualenv部署django
- nginx+gunicorn+virtualenv部署django项目
- 【django】Nginx+uWSGI+Django部署我的博客网站
- [django]django 部署,gunicorn、virtualenv、nginx
- ubuntu14.04下nginx+gunicorn部署django1.8
- virtualenv 环境下 Django + Nginx + Gunicorn+ Supervisor 搭建 Python Web