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

啥也没写

文章分类

全部博文(1763)

文章存档

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:30:33

安装
pip install uwsgi

mysite.ini配置

  1. [uwsgi]
  2. basedir=/root/python/mysite
  3. chdir=%(basedir)
  4. module=mysite.wsgi
  5. stats=/tmp/mysite.status
  6. memory-report=true
  7. log-fromat= %(addr) - %(user) [%(ltime)] "(%method) %(uri) %(proto)" %(status) %(size) "%(uagent)"
  8. master=True
  9. processes=2
  10. pidfile=%(basedir)/mysite.pid
  11. vacuum=True
  12. enable-threads=True
  13. max-requests=1000
  14. socket=127.0.0.1:8001
  15. daemonize=%(basedir)/logs/mysite.log

启动脚本

  1. #!/bin/bash
  2. PRO_DIR=/root/python/mysite
  3. UWSGI=/usr/local/anaconda3/bin/uwsgi
  4. CONFIGURE=$PRO_DIR/mysite.ini
  5. PID_FILE=$PRO_DIR/mysite.pid
  6. case "$1" in
  7. start)
  8. $UWSGI --ini $CONFIGURE
  9. echo "start uwsgi ok"
  10. ;;
  11. stop)
  12. $UWSGI --stop $PID_FILE
  13. echo "stop uwsgi ok"
  14. ;;
  15. reload)
  16. $UWSGI --reload $PID_FILE
  17. echo "reload uwsgi ok"
  18. ;;
  19. restart)
  20. stop
  21. /bin/sleep 1
  22. start
  23. ;;
  24. *)
  25. echo "$0 (start|stop|reload|restart)"
  26. exit 1
  27. ;;
  28. 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. uwsgi_pass 127.0.0.1:8001;
  9. }
  10. location ^~ /static {
  11. access_log off;
  12. alias /root/python/mysite/static;
  13. }
  14. }

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