Linux之Centos7版本一键部署Nginx轻量级Web服务器脚本

!/bin/bashDate : 2019/7/29Name : wuyangQQ : 2450497338准备安装Nginx安装环境

  wget http://nginx.org/download/nginx-1.14.2.tar.gz &>/dev/null

释放Nginx压缩包

  tar xf nginx-1.14.2.tar.gz

切换Nginx 文件夹目录

  cd nginx-1.14.2/

Yum下载编译依赖包

  yum -y install gcc gcc-c++ pcre pcre-devel zlib zlib-devel &>/dev/null

make 编译安装

  ./configure &>/dev/null && make -j 4 &>/dev/null && make install &>/dev/null

切换到Nginx安装目录

  cd /usr/local/nginx/sbin/

启动Nginx

  ./nginx

验证Nginx是否启动

  ps -aux | grep nginx &>/dev/null
echo $? &> /dev/null
if [ $? -eq 0 ];then
echo “欢迎使用Nginx最新版本”
else
echo “Nginx启动失败,请查找原因”
fi