1、安装supervisor管理进程的工具
pip install supervisor
2、安装nginx
yum install epel-release
sudo
yum
install
python-devel nginx
3、安装uWSGI(uWSGI是实现了WSGI协议、uwsgi、http等协议的一个web服务器)
了解uWSGI参考:https://blog.csdn.net/l_vip/article/details/81487608
- WSGI是一种Web服务器网关接口。它是一个Web服务器(如nginx,uWSGI等服务器)与web应用(如用Flask框架写的程序)通信的一种规范。
- uwsgi是一种线路协议而不是通信协议,在此常用于在uWSGI服务器与其他网络服务器的数据通信。
- 而uWSGI是实现了uwsgi和WSGI两种协议的Web服务器。
- uwsgi协议是一个uWSGI服务器自有的协议,它用于定义传输信息的类型(type of information),每一个uwsgi packet前4byte为传输信息类型描述,它与WSGI相比是两样东西。
安装命令:sudo
pip
install
uwsgi --upgrade
该命令会将uwsgi安装在 /usr/local/bin/uwsgi ,你需要手动添加服务,建立 /etc/ini/uwsgi.conf 文件,内容如下:
description "uWSGI Emperor"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /usr/local/bin/uwsgi --emperor /etc/uwsgi/vassals/ --logto /var/log/uwsgi/uwsgi.log
然后你就可以通过如下的命令来管理uwsgi的进程了: