leafsummer
9/30/2016 - 7:06 AM

install the nginx

install the nginx

#!/bin/sh
#install the nginx

INSTALLER=`pwd`
MAKE=make

if [ ! -f "$INSTALLER/nginx_src_installer.sh" ]; then
    echo "SYSMANAGER: can not find $INSTALLER/nginx_src_installer.sh"
    exit 1
fi

if [ ! -f "$INSTALLER/nginx-1.10.1.tar.gz" ]; then
    echo "SYSMANAGER: can not find $INSTALLER/nginx-1.10.1.tar.gz"
    exit 1
fi

if [ ! -f "$INSTALLER/pcre-8.39.tar.gz" ]; then
    echo "SYSMANAGER: can not find $INSTALLER/pcre-8.39.tar.gz"
    exit 1
fi

if [ ! -f "$INSTALLER/zlib-1.2.8.tar.gz" ]; then
    echo "SYSMANAGER: can not find $INSTALLER/zlib-1.2.8.tar.gz"
    exit 1
fi

if [ -f "/etc/debian_version" ]; then
    apt-get install -y make gcc g++ openssl libssl-dev
elif [ -f "/etc/redhat-release" ]; then
    yum install -y make gcc gcc-c++ python-devel openssl openssl-devel
fi

tar -zxf $INSTALLER/nginx-1.10.1.tar.gz
tar -zxf $INSTALLER/pcre-8.39.tar.gz
tar -zxf $INSTALLER/zlib-1.2.8.tar.gz

mkdir -p /var/cache/nginx/client_temp
mkdir -p /var/cache/nginx/proxy_temp
mkdir -p /var/cache/nginx/fastcgi_temp
mkdir -p /var/cache/nginx/uwsgi_temp
mkdir -p /var/cache/nginx/scgi_temp

cd $INSTALLER/nginx-1.10.1/
./configure --prefix=/etc/nginx \
            --sbin-path=/usr/sbin/nginx \
            --conf-path=/etc/nginx/nginx.conf \
            --error-log-path=/var/log/nginx/error.log \
            --http-log-path=/var/log/nginx/access.log \
            --pid-path=/var/run/nginx.pid \
            --lock-path=/var/run/nginx.lock \
            --http-client-body-temp-path=/var/cache/nginx/client_temp \
            --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
            --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
            --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
            --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
            --user=nginx \
            --group=nginx \
            --with-http_ssl_module \
            --with-http_dav_module \
            --with-http_flv_module \
            --with-http_realip_module \
            --with-http_gunzip_module \
            --with-http_gzip_static_module \
            --with-http_stub_status_module \
            --with-http_random_index_module \
            --with-http_auth_request_module \
            --with-mail \
            --with-mail_ssl_module \
            --with-threads \
            --with-stream \
            --with-stream_ssl_module \
            --with-http_slice_module \
            --with-file-aio \
            --with-http_v2_module \
            --with-ipv6 \
            --with-pcre=../pcre-8.39 \
            --with-zlib=../zlib-1.2.8 \
            --with-debug


$MAKE
$MAKE install

echo "Install nginx-1.10.1 is completed !"