Skip to content

Instantly share code, notes, and snippets.

@amanualt amanualt/nginx.sh
Last active May 16, 2018

Embed
What would you like to do?
#/bin/bash
#install nginx
apt install -y dpkg-dev build-essential \
zlib1g-dev \
libpcre3 \
libpcre3-dev \
unzip \
python-software-properties \
software-properties-common \
libpcre3 \
libpcre3-dev \
uuid-dev \
bzip2 \
libssl-dev \
daemon \
libgeoip-dev
#create parent direktory
mkdir -p ~/nginx/modules
#install pagespeed
NPS_VERSION=1.13.35.2-stable
cd ~/nginx/modules
wget https://github.com/apache/incubator-pagespeed-ngx/archive/v${NPS_VERSION}.zip
unzip v${NPS_VERSION}.zip
nps_dir=$(find . -name "*pagespeed-ngx-${NPS_VERSION}" -type d)
cd "$nps_dir"
NPS_RELEASE_NUMBER=${NPS_VERSION/beta/}
NPS_RELEASE_NUMBER=${NPS_VERSION/stable/}
psol_url=https://dl.google.com/dl/page-speed/psol/${NPS_RELEASE_NUMBER}.tar.gz
[ -e scripts/format_binary_url.sh ] && psol_url=$(scripts/format_binary_url.sh PSOL_BINARY_URL)
wget ${psol_url}
tar -xzvf $(basename ${psol_url}) # extracts to psol/
#install naxis
NNX_VERSION=master
NNX_NAME=ngx_naxsi
cd ~/nginx/modules
wget https://github.com/nbs-system/naxsi/archive/${NNX_VERSION}.zip
unzip ${NNX_VERSION}.zip
#install cache purge
cd ~/nginx/modules
wget https://github.com/FRiCKLE/ngx_cache_purge/archive/2.3.zip
unzip 2.3.zip
#INSTALL NGINX
NGINX_VERSION=1.14.0
cd ~/nginx/
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
tar -xvzf nginx-${NGINX_VERSION}.tar.gz
cd nginx-${NGINX_VERSION}/
./configure --add-module=$HOME/$nps_dir \
--add-module=/root/nginx/modules/naxsi-master/naxsi_src \
--add-module=/root/nginx/modules/ngx_cache_purge-2.3
make
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.