上干货:
#!/bin/bash
version="1.13.6.2"
name=openresty-$version
file=$name.tar.gz
prefix=/usr/local/openresty
TOOLS_DIR=/home/sunbox/soft
INSTALL_DIR=/usr/local
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to install"
exit 1
fi
# Check network environmental
#NET_NUM=`ping -c 4 www.baidu.com |awk '/packet loss/{print $6}' |sed -e 's/%//'`
#if [ -z "$NET_NUM" ] || [ $NET_NUM -ge 10 ];then
# echo "Please check your internet"
# exit 1
#fi
#安装编译工具
yum -y install gcc gcc-c++ readline-devel pcre-devel openssl-devel tcl perl
[ ! -d $TOOLS_DIR ] && mkdir -pv $TOOLS_DIR
cd $TOOLS_DIR
#echo $file
if [ ! -f $file ]; then
wget http://47.92.71.36:28801/$file
#wget https://openresty.org/download/$file
fi
#tar zxvf soft.tgz -C $INSTALL_DIR
tar zxvf $file -C $INSTALL_DIR
#cd $INSTALL_DIR/openresty
chown -R root:root $INSTALL_DIR/$name
cd $INSTALL_DIR/$name
./configure --prefix=/usr/local/openresty --with-luajit --with-http_stub_status_module --with-http_realip_module --with-http_v2_module --with-http_ssl_module --without-http_redis2_module --with-http_iconv_module
make -j2
make install
#./configure --prefix=/usr/local/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module --with-http_ssl_module --with-http_realip_module --with-http_v2_module
#gmake
#gmake install
#cd $INSTALL_DIR/openresty/nginx/conf && cp nginx.conf.default nginx.conf
cd $INSTALL_DIR/openresty/nginx/sbin && ./nginx