Shell安装Nginx

1.云盘下载 Shell脚本

https://pan.baidu.com/s/1snmKXIX

2.编写installNginx.sh Shell文件

#!/bin/bash

mydir=`pwd`

if [ ! -f "$mydir/nginx-1.10.2.tar.gz" ];then
        wget http://nginx.org/download/nginx-1.10.2.tar.gz
fi
if [ ! -f "$mydir/openssl-fips-2.0.10.tar.gz" ];then
        wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz
fi
if [ ! -f "$mydir/zlib-1.2.11.tar.gz" ];then
        wget http://zlib.net/zlib-1.2.11.tar.gz
fi
if [ ! -f "$mydir/pcre-8.40.tar.gz" ];then
        wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
fi

cd /etc/yum.repo.d/
rm -rf *.repo

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

cd $mydir

yum -y install gcc-c++

rm -rf openssl-fips-2.0.10
rm -rf pcre-8.40
rm -rf zlib-1.2.11
rm -rf nginx-1.10.2

tar zxvf openssl-fips-2.0.10.tar.gz
cd openssl-fips-2.0.10
./config && make && make install

cd ..

tar zxvf pcre-8.40.tar.gz
cd pcre-8.40
./configure && make && make install

cd ..

tar zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure && make && make install

cd ..

tar zxvf nginx-1.10.2.tar.gz
cd nginx-1.10.2
./configure && make && make install

cd ..

ln -s /usr/local/lib/libpcre.so.1 /lib64

/usr/local/nginx/sbin/nginx

3.修改installNginx.sh 文件执行属性

chmod +x installNginx.sh

4.执行installNginx.sh

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值