Skip to content

Instantly share code, notes, and snippets.

@grantmacken
Last active December 16, 2015 04:59
Show Gist options
  • Save grantmacken/5381133 to your computer and use it in GitHub Desktop.
Save grantmacken/5381133 to your computer and use it in GitHub Desktop.
my compile from source Nginx and install bash script for Ubuntu Server
#######################################
# nginx-install.sh
#Grant MacKenzie <grantmacken@gmail.com>
#v0.1, April 2013
#
#Installing nginx
#^^^^^^^^^^^^^^^^
#
#Nginx server: the latest stable version of
# http://wiki.nginx.org/Install
#
#The PCRE library:
# http://www.pcre.org/
#
#The zlib compression library:
#http://zlib.net
#
#OpenSSL Project Secure Sockets Layer library
# http://www.openssl.org/
#
# git clone https://gist.github.com/5381133.git
# chmod +x nginx-install.sh
# sudo ./nginx-install.sh
###########################################
if [ ! -d /usr/local/src ]; then
mkdir /usr/local/src
fi
cd /usr/local/src
NGINX_VERSION='1.4.0'
PCRE_VERSION='8.32'
ZLIB_VERSION='1.2.7'
OPENSSL_VERSION='1.0.1e'
NGINX_gz="nginx-$NGINX_VERSION.tar.gz"
OPENSSL_gz="openssl-$OPENSSL_VERSION.tar.gz"
PCRE_gz="pcre-$PCRE_VERSION.tar.gz"
ZLIB_gz="zlib-$ZLIB_VERSION.tar.gz"
NGINX_CONF_DIR=/usr/local/nginx/conf
if [ ! -e $NGINX_gz ]; then
wget --verbose http://nginx.org/download/$NGINX_gz
fi
if [ ! -e $OPENSSL_gz ]; then
wget --verbose http://www.openssl.org/source/$OPENSSL_gz
fi
if [ ! -e $PCRE_gz ]; then
wget --verbose ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/$PCRE_gz
fi
if [ ! -e $ZLIB_gz ]; then
wget --verbose http://zlib.net/$ZLIB_gz
fi
tar xfvz $NGINX_gz
tar xfvz $OPENSSL_gz
tar xfvz $PCRE_gz
tar xfvz $ZLIB_gz
cd nginx-$NGINX_VERSION
./configure \
--with-select_module \
--with-http_gzip_static_module \
--with-pcre=/usr/local/src/pcre-$PCRE_VERSION \
--with-http_ssl_module \
--with-openssl=../openssl-$OPENSSL_VERSION \
--with-zlib=../zlib-$ZLIB_VERSION
make
make install
#adduser --system --no-create-home --disabled-login --disabled-password --group nginx
#
##sudo usermod -G nginx -a grant
##NGINX_CONF_DIR=/usr/local/nginx/conf
#chmod 775 $NGINX_CONF_DIR -R
#chown nginx:admin $NGINX_CONF_DIR -R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment