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