uWSGI安装配置
官方网站:
环境:
CentOS 7.2
python-2.7.5
一.安装
yum -y install gcc gcc-c++ python-devel
curl -sSL https://projects.unbit.it/downloads/uwsgi-2.0.14.tar.gz |tar
-xvf - --gzip
cd uwsgi-2.0.14
make -j4
################# uWSGI
configuration #################
pcre = True
kernel = Linux
malloc = libc
execinfo = False
ifaddrs = True
ssl = True
zlib = True
locking =
pthread_mutex
plugin_dir = .
timer = timerfd
yaml = embedded
json = False
filemonitor =
inotify
routing = True
debug = False
ucontext = True
capabilities =
False
xml = libxml2
event = epoll
############## end of uWSGI
configuration #############
total build time: 0
seconds
*** uWSGI is ready, launch it
with ./uwsgi ***
编译完会生成二进制文件uwsgi,将其copy到PATH路径下即可,这里放到/usr/bin下
二.创建配置文件
以ini格式为例
mkdir -p /etc/uwsgi/valsals
cat
> /etc/uwsgi/emperor.ini<<EOF
[uwsgi]
emperor = /etc/uwsgi/vassals
ini= :app1
[app1]
socket = :9090
socket = /dev/shm/uwsgi.sock
processes = 10
master = true
EOF
三.配置systemd管控
cat >/lib/systemd/system/emperor.uwsgi.service <<EOF
[Unit]
Description=uWSGI Emperor
After=syslog.target
[Service]
ExecStart=/usr/bin/uwsgi --ini /etc/uwsgi/emperor.ini
# Requires systemd version 211 or newer
RuntimeDirectory=uwsgi
Restart=always
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all
[Install]
WantedBy=multi-user.target
EOF
四.启动uwsgi
root@router:~#netstat -tunlp|grep :9090
tcp
root@router:~#ll
/dev/shm/uwsgi.sock
srwxr-xr-x. 1 root
root 0 10月