linux下部署uwsgi+nginx+django2.0

Posted peterwxm

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux下部署uwsgi+nginx+django2.0相关的知识,希望对你有一定的参考价值。

1.安装uwsgi

pip install uwsgi

2.在项目根目录新建uwsgi.ini,内容如下:

[uwsgi]
socket = 0.0.0.0:8001
socket-time = 900
chdir = /home/xxx/project/djangoPro
module = djangoPro.wsgi
master = true
processes = 1
thread = 1
vacuum = true
buffer-size = 65535
max-requesys = 60000
env = DJANGO_SETING_MODULE=djangoPro,settings
pythonpath = /home/wangximeng/miniconda3/bin
pidfile = uwsgi.pid

3.安装nginx

4.配置nginx,添加内容如下:

http{
    ...
    upstream myweb{
        server 127.0.0.1 weight=1;
    }
}

server{
    listen 80;
    server_name localhost;
    location / {
        root html;
        index index.html index.htm;
        include uwsgi_params;
        uwsgi_pass myweb;
        client_max)body_size 50m;
        uwsgi_read_timeout 600;
    }   
    ...
}

5.启动uwsgi:

uwsgi --ini uwsgi.ini

6.停止uwsgi:

uwsgi --stop uwsgi.pid

7.重启uwsgi:

uwsgi --reload uwsgi.pid

 

以上是关于linux下部署uwsgi+nginx+django2.0的主要内容,如果未能解决你的问题,请参考以下文章

瞬间心情愉悦,头发都少掉了几根!---Django+uwsgi+Nginx项目部署超详细步骤

Linux下安装部署 Nginx + uWSGI + Django

Django + Uwsgi + Nginx 的生产环境部署

CentOS 7 下Django项目部署教程(基于uwsgi和Nginx)

uwsgi+nginx反向代理项目部署

uWSGI+Nginx+Flask在Linux下的部署