参考文档
 
安装:
pip install uwsgi
启动命令:
方法一、直接命令启动
/home/zabbix/application/python/bin/uwsgi --socket 0.0.0.0:9090 --chdir /home/zabbix/application/websugar --wsgi-file /home/zabbix/application/websugar/websugar/wsgi.py --master --processes 4 --threads 2 --stats 0.0.0.0:9191
方法二、配置文件方法启动
配置文件内容:
[uwsgi]
chdir=/path/to/your/project
module=mysite.wsgi:application
master=True
pidfile=/tmp/project-master.pid
vacuum=True
max-requests=5000
daemonize=/var/log/uwsgi/yourproject.log
使用配置文件启动命令:
uwsgi --ini uwsgi.ini

参数介绍:

uwsgi
--chdir=/path/to/your/project \ #项目目录(manage.py 所在目录)
--module=mysite.wsgi:application \ #application为项目下的app
--env DJANGO_SETTINGS_MODULE=mysite.settings \ #配置项目的配置文件
--master #作为主进程运行
--pidfile=/tmp/project-master.pid \ #指定进程文件
--socket=127.0.0.1:49152 \ #配置监听端口和地址 也可以指定成文件如--socket=/tmp/zqxt.sock
--processes=5 \ #worker进程数
--threads #每个进程的线程数
--uid=1000 --gid=2000 \ #如果是root用户,可以指定运行用户
--harakiri=20 \ #请求超时20秒则重启进程
--max-requests=5000 \ #处理5000请求后重启进程
--vacuum \ #退出时清空环境
--home=/path/to/virtual/env \ #python 环境路径
--daemonize=/var/log/uwsgi/yourproject.log #项目日志文件

  

  

django settings.py配置修改:
DEBUG = False
ALLOWED_HOSTS = ['*']
nginx配置:
        location /static {
root static;
}
location / {
uwsgi_pass 127.0.0.1:9090; #指定监听地址和端口时使用,如uwsgi指定的是文件则使用uwsgi_pass  unix:///tmp/zqxt.sock;
include uwsgi_params;
}

django之uWSGI配置 +Nginx的更多相关文章

  1. Django部署--uwsgi配置--nginx服务器配置

    uwsgi.ini文件 [uwsgi] #使用nginx连接时使用,Django程序所在服务器地址 socket=127.0.0.1:8000 #直接做web服务器使用,Django程序所在服务器地址 ...

  2. django,uwsgi, nginx部署项目

    在liunx中环境中 对于nginx来说: 1.先安装nginx sudo apt-get install nginx 2.启动nginx服务 sudo /etc/init.d/nginx resta ...

  3. centos7.3部署django用uwsgi和nginx[亲测可用]

    现在nginx nginx version: nginx/1.10.2 uwsgi 2.0.17 django2.0.5 都已经完成完毕,那么开始 uwsgi 配置 uwsgi支持ini.xml等多种 ...

  4. Django with uWSGI and nginx

    Reference:http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html Setting up Dja ...

  5. Django部署uwsgi 与 nginx配置

    1.nginx文件的配置 路径:/etc/nginx/conf.d/ example.conf 启动:service nginx [start]/[restart]/[stop] upstream d ...

  6. 【使用uWSGI和Nginx来设置Django和你的Web服务器】

    目录 安装使用uWSGI 配置Nginx结合uWSGI supervisor Django静态文件与Nginx配置 @ *** 所谓WSGI . WSGI是Web服务器网关接口,它是一个规范,描述了W ...

  7. ubuntu下配置nginx+uwsgi+django

    服务器配置是Ubuntu14.04 64位OS ubuntu14.04默认是安装好了python2.7版本不用自己安装了. 先更新下源 sudo apt-get update 第一步先安装pip su ...

  8. centos6.5配置uwsgi与nginx支持django

    一.centos中升级python 1. > wget https://www.python.org/ftp/python/3.5.4/Python-3.5.4.tgz # https://ww ...

  9. 第四百零二节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署,uwsgi安装和启动,nginx的安装与启动,uwsgi与nginx的配置文件+虚拟主机配置

    第四百零二节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署,uwsgi安装和启动,nginx的安装与启动,uwsgi与nginx的配置文件+虚拟主机配置 软件版本  uwsgi- ...

随机推荐

  1. 整不明白Jquery的问题

    最近写个GridView,由于不是很熟悉javascript,用jquery实现后,发现下面设置左右表行高的代码如果不把行保存在$tr1,$tr2中再设置css,速度非常慢,300行50列左右的数据得 ...

  2. Android动态加载代码技术

    Android动态加载代码技术 在开发Android App的过程当中,可能希望实现插件式软件架构,将一部分代码以另外一个APK的形式单独发布,而在主程序中加载并执行这个APK中的代码. 实现这个任务 ...

  3. CentOS 6.4 LNMP 环境编译安装

    1.关闭 SELinux 编辑 /etc/selinux/config SELINUX="disabled" 2.安装编译器 yum install gcc gcc-c++ -y ...

  4. visual studio 2008安装报错问题处理

    今天刚入职,安装visual studio 2008时报错说web创建组件安装错误,后来发现是因为之前这电脑安装visual studio 2008的时候是office2007刚安装的版本,可是后来系 ...

  5. php版权重轮询调度算法

    2013-09-25 <?php class WeightedRoundRobin { private static $_weightArray = array(); private stati ...

  6. 手机三种SIM卡 你所不知道的剪卡“秘密”

    SIM卡物理尺寸的发展是逐渐轻薄化,尺寸逐渐缩小的一个过程,最早手机中的卡都是2FF,2003年国际标准提出3FF,当前很多终端都使用这种形态的卡,4FF在2011年的国际标准会议中提出,2012年纳 ...

  7. Delphi泛型评测(30篇)

    http://www.cnblogs.com/jxgxy/category/216671.html

  8. 如何为WPF添加Main()函数 程序入口点的修改

    一般的.WPF的Main()函数是自动生成的,不过有时候我们需要为我们的应用程序传参.那么自动生成的Main()函数就不会满足我们的要求. 那么如何为WPF Application 设置Main()函 ...

  9. Google API v3 设置Icon问题处理

    1.查看API实现 //虽然比较符合API实现的思想但这个没法; //会产生Uncaught TypeError: undefined is not a function //google API n ...

  10. What is NicEdit?

    NicEdit - WYSIWYG Content Editor, Inline Rich Text Application   What is NicEdit? NicEdit is a Light ...