1 .安装
pip 3安装uw SGI
2 .新配置文件
mkdir /etc/uwsgi
vim /etc/uwsgi/uwsgi.ini
3 .写入配置文件
[uwsgi]
uid=root
GID=根
socket=127.0.0.1:8111 #项目启动的ip:端口
主进程=true//启动主进程
vhost=true //多站模式
no-site=true //多站模式时,不设定模块和部件
工作器=2//进程数
重新加载-内存=10//顺利重新启动
vacuum=true //退出,重新启动时清洗
打开max-requests=1000//10000进程后,在respawn中
将limit-as=512 //进程的总内存量控制在512M
buffer-size=30000
在pidfile=/var/run/uw SGI 8111.PID//PID条件下的脚本中启动和停止进程
daemonize=/var/log/uw SGI 8111.log
python path=/root/jiangsqobj/lib/python 3.6/site-packages//添加虚拟环境(如果存在)添加python安装路径
4 .启动
方法1
1 .启动
uwsgi --ini /etc/uwsgi/uwsgi.ini
2 .测试是否启动
netstat -ntpl
3 .显示工艺编号
cat /var/run/uwsgi8111.pid
4 .杀戮进程
kill -9 81392
killall -9 uwsgi
方法2
1 .新建配置文件
vim /etc/init.d/uwsgi
2 .写入启动脚本
#! 实用的早晨/sh
DESC='uwsgi daemon '
NAME=uwsgi
DAEMON=/usr/local/务实的早晨/uwsgi
config file=/etc/uw SGI/$ { name } 9090.ini
PIDFILE=/var/run/$NAME.pid
脚本名称=/etc/init.d/$ name
FIFOFILE=/tmp/uwsgififo
设置- e
[ -x '$DAEMON' ] || exit 0
do_start ()
if [! -f $PIDFILE ]; 陈真
$ daemon $ config file|| echo-n ' uwsgirunning '
else
echo 'The PID is exist . '
fi
}
do_stop () }
if [ -f $PIDFILE ]; 陈真
$ daemon-- stop $ pidfile|| echo-n ' uwsginotrunning '
rm -f $PIDFILE
echo '$DAEMON STOPED.'
else
echo 'The $PIDFILE doesn't found '
fi
}
do_reload
if [ -p $FIFOFILE ]; 陈真
echo w $FIFOFILE
else
$ daemon-- touch-workers-reload $ pidfile|| echo-n ' uw SGI
can't reload '
fi
}
do_status () }
PS aux
}
case '$1' in
斯塔茨)
echo -en 'Status $NAME: n '
do_status
;
开始)
echo -en 'Starting $NAME: n '
do_start
;
停止)
echo -en 'Stopping $NAME: n '
do_stop
;
reload (加载)
echo -en 'Reloading $NAME: n '
do_reload
;
* )
echo ' usage : $ script name { start } stop } ' 2
exit 3
;
欧洲联盟
exit 0
3 .启动
/etc/init.d/uwsgi start
4 .显示
netstat -ntpl
/etc/init.d/uwsgi status
5 .关闭
/etc/init.d/uwsgi stop
标签: do,NAME,配置,echo,etc,PIDFILE,Linux,uwsgi
资料来源: https://www.cn blogs.com/JT 925/p/12727075.html