nginx 在线安装脚本
echo -e "\033[31m====================注意====================\033[0m"
echo "#安装包放在/data/soft/下"
echo "#安装路径在/data/app/nginx/下"
mkdir -p /data/app
mkdir -p /data/soft
useradd -M -s /sbin/nologin nginx
sleep 2
echo "安装nginx所需插件......"
yum -y install pcre pcre-devel openssl openssl-devel gcc gcc-c++
echo "检查是否有wget命令,并通过wget下载nginx包到/data/soft/"
if [ `rpm -qa | grep wget | wc -l` -eq 1 ];then
read -p "请输入需要下载的版本号(x.x.x格式):" version
cd /data/soft/
wget http://nginx.org/download/nginx-${version}.tar.gz
else
yum -y install wget
read -p "请输入需要下载的版本号(x.x.x格式):" version
cd /data/soft/
wget http://nginx.org/download/nginx-${version}.tar.gz
fi
tar xvf nginx-${version}.tar.gz
cd nginx-${version}
./configure --user=nginx --group=nginx --prefix=/data/app/nginx --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-stream && make && make install
cat <<EOF > /etc/profile.d/nginx.sh
nginx_home=/data/app/nginx
PATH=$nginx_home/bin:$PATH
export PATH
EOF
source /etc/profile
nginx
作者:james
-------------------------------------------
个性签名:独学而无友,则孤陋而寡闻。做一个灵魂有趣的人!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!
posted on 2019-08-12 11:42 james的运维之路 阅读(361) 评论(0) 收藏 举报
浙公网安备 33010602011771号