uwsgi部署
uwsgi最新稳定版(uwsgi-2.0.19.1)源码
yum install gcc python3-devel.x86_64 wget http://projects.unbit.it/downloads/uwsgi-latest.tar.gz tar xf uwsgi-latest.tar.gz cd uwsgi-2.0.19.1 python3 uwsgiconfig.py --build python3 setup.py install
注意:
编译好会生成一个uwsgi可执行文件
用什么编译环境就是什么,不支持uwsgi.ini自定义环境
uwsgi配置文件
#vi uwsgi.ini [uwsgi] socket = 127.0.0.1:8000 chdir = /data/soft/agent_flask wsgi-file = /data/soft/agent_flask/myproject/wsgi.py callable = app master = true processes = 10 buffer-size=65535 vacuum = true enable-threads = true pidfile = /data/soft/agent_flask/logs/uwsgi.pid
nginx配置文件
#vi agent_flask.conf server { listen 80; server_name 127.0.0.1 192.168.209.211; charset utf-8; client_max_body_size 75M; index index.html index.htm index.php; location / { include uwsgi_params; uwsgi_pass 127.0.0.1:8000; # uwsgi启动端口 uwsgi_param UWSGI_PYTHON /usr/bin; # 系统中Python的目录路径 uwsgi_param UWSGI_SCRIPT uwsgi:app; #项目入口文件 } access_log /data/logs/agent_flask.acc.log main; error_log /data/logs/agent_flask.err.log error; }
启动
./uwsgi uwsgi.ini
./uwsgi --stop /data/soft/agent_flask/logs/uwsgi.pid
个人GitHub项目有纯净编译好的uwsgi环境