uWSGI安装配置
官方網站: http://uwsgi-docs.readthedocs.io
環境: 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下
二.創建配置文件 http://uwsgi-docs.readthedocs.io/en/latest/Configuration.html 以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管控 http://uwsgi-docs.readthedocs.io/en/latest/Systemd.html http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
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? ? ? ? 0? ? ? 0 0.0.0.0:9090? ? ? ? ? ? 0.0.0.0:* ? ? ? ? ? ? ? LISTEN? ? ? 31117/uwsgi? ? ? ? ?
root@router:~#ll /dev/shm/uwsgi.sock?
srwxr-xr-x. 1 root root 0 10月? 9 05:16 /dev/shm/uwsgi.sock=
轉載于:https://www.cnblogs.com/lixuebin/p/10814015.html
總結
- 上一篇: Y/C分离/2/3D滤波器
- 下一篇: docker镜像存储在哪里