栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Ubuntu下配置nginx+uwsgi+django

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Ubuntu下配置nginx+uwsgi+django

安装uwsgi

环境是ubuntu18.04+python3.8.8
首先安装好anaconda环境,后面的包都用conda安装,能自动解决依赖问题。

  1. conda换清华源
  2. conda config --add channels conda-forge
  3. conda config --set channel_priority flexible
  4. conda update -n base conda
  5. conda update --all
  6. conda install -c conda-forge uwsgi
验证uwsgi安装成功

新建文件test.py

def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    return [b"Hello World"]

输入命令

uwsgi --http :8001 --wsgi-file test.py
安装nginx
  1. sudo apt-get install nginx
验证nginx安装成功

改nginx.conf(改之前先备份)

events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    server {
        listen       8080;
        server_name  localhost;
        charset utf-8;
        location / {
		root html;
		index index.html inde.htm;
        }
    }
}

root账号运行命令

sudo su
nginx
配置nginx+uwsgi+django
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/422916.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号