Skip to content

Instantly share code, notes, and snippets.

@darjun
Created March 14, 2019 07:56
Show Gist options
  • Save darjun/3bf0dc231b02f38d3b2be450a53c3db4 to your computer and use it in GitHub Desktop.
Save darjun/3bf0dc231b02f38d3b2be450a53c3db4 to your computer and use it in GitHub Desktop.
download, build, install nginx 1.10.2
#!/bin/sh
# get nginx tar.gz file
if [ ! -f "nginx-1.10.2.tar.gz" ]; then
wget http://nginx.org/download/nginx-1.10.2.tar.gz
else
echo "nginx-1.10.2.tar.gz file exists, do not download"
fi
# uncompress the tar.gz file
if [ ! -d "nginx-1.10.2" ]; then
tar -xvf nginx-1.10.2.tar.gz
else
echo "nginx-1.10.2 directory exists, do not uncompress"
fi
# get zlib zip file
if [ ! -f "zlib-1.2.3.tar.gz" ]; then
wget http://www.zlib.net/fossils/zlib-1.2.3.tar.gz
else
echo "zlib-1.2.3.tar.gz file exists, do not download"
fi
if [ ! -d "zlib-1.2.3" ]; then
tar -xvf zlib-1.2.3.tar.gz
else
echo "zlib-1.2.3 directory exists, do not uncompress"
fi
# get openssl tar.gz file
if [ ! -f "openssl-OpenSSL_1_0_2j.zip" ]; then
wget -O openssl-OpenSSL_1_0_2j.zip https://codeload.github.com/openssl/openssl/zip/OpenSSL_1_0_2j
else
echo "openssl-OpenSSL_1_0_2j.zip file exists, do not download"
fi
if [ ! -d "openssl-OpenSSL_1_0_2j" ]; then
unzip openssl-OpenSSL_1_0_2j.zip
else
echo "openssl-OpenSSL_1_0_2j directory exists, do not unzip"
fi
# get pcre tar.bz2 file
if [ ! -f "pcre-8.40.tar.bz2" ]; then
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.bz2
else
echo "pcre-8.40.tar.bz2 file exists, do not download"
fi
if [ ! -d "pcre-8.40" ]; then
tar -xvf pcre-8.40.tar.bz2
else
echo "pcre-8.40 directory exists, do not uncompress"
fi
# enter nginx directory
echo "cd nginx"
cd nginx-1.10.2
# configure
echo "configure nginx"
./configure --with-http_ssl_module --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.3/ --with-openssl=../openssl-OpenSSL_1_0_2j
# make
make -j16
# install
sudo make install
# nginx config
cd ..
sudo mv -f /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak
sudo cat nginx.conf.example >> /usr/local/nginx/conf/nginx.conf
# start nginx
/usr/local/nginx/sbin/nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment