首页 > 代码库 > nginx编译安装脚本

nginx编译安装脚本

#!/bin/bash
#Date:2017-05-05 By Allen_Jol
#--------- YUm Install related components------
sleep 3
yum install -y yum -y install make gcc gcc-c++  cmake openssl openssl-devel zlib zlib-devel


mkdir -p /usr/local/nginx

mkdir /lnmpsoftware
cd /lnmpsoftware
#-----------------Download Nginx-------------------
sleep 3
if [ ! -f nginx-1.8.1.tar.gz ]
then
  wget http://nginx.org/download/nginx-1.8.1.tar.gz
fi
#-----------------Install Nginx server--------------
sleep 3


if [ ! -d /usr/local/nginx ]
then
  mkdir /usr/local/nginx
fi
tar -zxvf nginx-1.8.1.tar.gz
cd nginx-1.8.1
if [ ! -f /usr/local/nginx/sbin/nginx ]
then
  ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx \
> --with-http_ssl_module
sleep 1
make && make install
fi


#------------------start  nginx service-------------
/usr/local/nginx/sbin/nginx
iptables -I INPUT  -p tcp --dport 80 -j ACCEPT
service iptables save


nginx编译安装脚本