代码语言:shell复制
# nginx编译安装
wget http://nginx.org/download/nginx-1.17.7.tar.gz
tar -zvxf nginx-1.17.7.tar.gz
.configure (很可能要补一堆下面的依赖包)
make && make install
# nginx配置检查
ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 开始
ps -ef | grep nginx 查看
kill -QUIT从容/TERM快速/9强制/HUP重启 主进程号
/usr/nginx/sbin/nginx -s reload 重启
/usr/nginx/sbin/nginx -t 测试
nginx -t -c /usr/local/nginx/conf/nginx.conf 测试
# nginx相关依赖
yum install -y gcc pcre pcre-devel openssl openssl-devel gd gd-devel
yum install gcc gcc-c pcre-devel patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel openssl-devel -y
# centos防火墙
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/rc.d/init.d/iptables save
# uwsgi安装
yum install libffi-devel
python3.7重新编译 | 否则可能No module named '_ctypes'
python3 -m pip install uwsgi
# uwsgi-cgi测试样例准备
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"]
# uwsgi测试
uwsgi --http :9001 --wsgi-file cgi.py
## uwsgi并发和监控
uwsgi --http :9090 --wsgi-file foobar.py --master --processes 4 --threads 2
## uwsgi监控工具
pip install uwsgitop