1、依賴python3版本: 安裝python3
yum install python3
2、安裝uwsgi包
yum groupinstall "Development tools"
yum install python3-devel.x86_64
pip3 install uwsgi
配置uwsgi
[uwsgi]
socket = 127.0.0.1:9000
master = true
workers = 4
chdir = /home/work/***
wsgi-file = ***.py
callable = application
#daemonize = ./uwsgi.log
pidfile = ***.pid
lazy = true
enable-threads = true
buffer-size = 65536
啓動uwsgi
uwsgi --ini /path/uwsgi.ini
3、安裝nginx:
yum install nginx -y
在/etc/nginx/conf.d中增加配置文件uwsgi.conf
server {
listen 8080;
server_name 127.0.0.1;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9000;
}
}
6、啓動nginx
service nginx start
官方資料:
https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html
https://michael.lustfield.net/nginx/bottle-uwsgi-nginx-quickstart