1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #!/bin/bash
- set -e
- cur_date="`date +%Y-%m-%d`"
- ROOT=$(cd `dirname $0`; pwd)
- mkdir -p $ROOT/tmp
- rm -rf $ROOT/tmp/*
- # NOTE: Adapted from https://github.com/moezzie/nginx-portable
- mkdir -p $ROOT/cache
- cd $ROOT/cache
- NGINX_NAME=$1
- NGINX_PREFIX_PATH=$2
- NGINX_ARCHIVE=$NGINX_NAME.tar.gz
- # Name cannot be empty
- if [ -z $NGINX_NAME ]; then
- echo "Usage: $0 <nginx-version> <prefix-path>"
- exit 1
- fi
- if [ -z $NGINX_PREFIX_PATH ]; then
- echo "Usage: $0 <nginx-version> <prefix-path>"
- exit 1
- fi
- if [ ! -r $NGINX_ARCHIVE ]; then
- echo "Downloading $NGINX_ARCHIVE..."
- wget https://nginx.org/download/$NGINX_ARCHIVE
- fi
- tar -zxf $NGINX_ARCHIVE
- cd $ROOT/cache/$NGINX_NAME
- if [ ! -r Makefile ]; then
- echo "Configuring $NGINX_NAME..."
- ./configure --prefix=$NGINX_PREFIX_PATH --sbin-path=bin/ --conf-path=conf/nginx.conf --error-log-path=logs/error.log --http-client-body-temp-path=tmp/client_body_temp/ --http-proxy-temp-path=tmp/proxy_temp/ --http-fastcgi-temp-path=tmp/fastcgi_temp/ --http-uwsgi-temp-path=tmp/uwsgi_temp/ --http-scgi-temp-path=tmp/scgi_temp/ --with-http_realip_module --with-ipv6 --with-http_gzip_static_module --with-http_stub_status_module --with-stream --with-pcre-jit --with-threads --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --without-http_fastcgi_module
- fi
- echo Building $NGINX_NAME...
- make
- mkdir -p $ROOT/tmp/nginx
- echo ✅ $NGINX_NAME built successfully.
|