Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7428595
  • 博文数量: 1758
  • 博客积分: 18684
  • 博客等级: 上将
  • 技术积分: 16252
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-02 10:28
个人简介

啥也没写

文章分类

全部博文(1758)

文章存档

2024年(3)

2023年(44)

2022年(39)

2021年(46)

2020年(43)

2019年(27)

2018年(44)

2017年(50)

2016年(47)

2015年(15)

2014年(21)

2013年(43)

2012年(143)

2011年(228)

2010年(263)

2009年(384)

2008年(246)

2007年(30)

2006年(38)

2005年(2)

2004年(1)

分类: 系统运维

2018-06-29 14:33:02

安装
/usr/local/anaconda3/bin/pip install gunicorn

配置:

  1. import multiprocessing
  2. bind = "127.0.0.1:8000"
  3. workers = multiprocessing.cpu_count() * 2 + 1
  4. basedir = "/root/python/mysite"
  5. errorlog = basedir+"/gunicorn.error.log"
  6. #loglevel = "debug"
  7. proc_name = "mysite"
  8. reload = True
  9. daemon = True

启动脚本

  1. #!/bin/bash
  2. GUNICORN=/usr/local/anaconda3/bin/gunicorn
  3. ROOT=/root/python/mysite
  4. PID=/tmp/gunicorn.pid
  5. APP=mysite.wsgi
  6. case "$1" in
  7. start)
  8. cd $ROOT
  9. exec $GUNICORN -c $ROOT/gunicorn/gunicorn.py -D --pid=$PID --error-logfile $ROOT/gunicorn/error.log $APP
  10. echo "gunicorn is start"
  11. ;;
  12. stop)
  13. kill `cat $PID`
  14. echo "gunicorn is stop"
  15. ;;
  16. *)
  17. echo "$0 (stop|start)"
  18. ;;
  19. esac


nginx配置

  1. server {
  2. listen 80;
  3. server_name _;
  4. access_log /var/log/nginx/mysite_access.log;
  5. error_log /var/log/nginx/mysite_error.log;
  6. include /etc/nginx/uwsgi_params;
  7. location / {
  8. proxy_pass
  9. }
  10. location ^~ /static {
  11. access_log off;
  12. alias /root/python/mysite/static;
  13. }
  14. }


阅读(1306) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~