uwsgi+django+nginx部署

uwsgi官方教程:http://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html
nginx官方教程:http://nginx.org/en/docs/http/ngx_http_uwsgi_module.html

vim /etc/uwsgi.ini

[uwsgi]
socket=127.0.0.1:3031
chdir=/root/project/seth_stack/
wsgi-file=seth_stack/wsgi.py
processes=4
threads=2
stats=127.0.0.1:9191

但是测试有问题
经百度需要安装uwsgi-plugin-python

yum install uwsgi-plugin-python

而且配置文件需要加一行

plugins = python

因为我是yum install uwsgi安装的
所以这里没有使用supervisor

最后配置文件为

[uwsgi]
socket=127.0.0.1:3031 #nginx那边的uwsgi_pass地址
chdir=/root/project/seth_stack/ #项目根路径
wsgi-file=myproject/wsgi.py #项目路径下面的主app下面的wsgi.py
processes=4  #根据需要配置
threads=2
stats=127.0.0.1:9191 #监控状态的,可以不配置

顺便贴下nginx的server

server {
        listen       80 default_server;
        listen       [::]:80 default_server; #ipv6可以删掉
        server_name  _;
        root         /usr/share/nginx/html;#这个root无所谓


        include /etc/nginx/default.d/*.conf;
        #资源目录
        location ^~ /assets/ {
            root /opt/;
        }
        访问uwsgi
        location / {
            uwsgi_pass 127.0.0.1:9000;
            include uwsgi_params;
        }
        #错误页随便配置
        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

bwlab

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值