- 结构
Flask + uwsgi + nginx uwsgi部署
uwsgi最新稳定版(uwsgi-2.0.19.1)源码yum install gcc python3-devel.x86_64wget http://projects.unbit.it/downloads/uwsgi-latest.tar.gztar xf uwsgi-latest.tar.gzcd uwsgi-2.0.19.1python3 uwsgiconfig.py --buildpython3 setup.py install
注意:
编译好会生成一个uwsgi可执行文件
用什么编译环境就是什么,不支持uwsgi.ini自定义环境uwsgi配置文件
#vi uwsgi.ini [uwsgi]socket = 127.0.0.1:8000chdir = /data/soft/agent_flaskwsgi-file = /data/soft/agent_flask/myproject/wsgi.pycallable = appmaster = trueprocesses = 10buffer-size=65535vacuum = trueenable-threads = truepidfile = /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环境