Skip to content

Instantly share code, notes, and snippets.

@goblindegook
Last active June 29, 2017 08:34
Show Gist options
  • Save goblindegook/8daabea25da8c696205d to your computer and use it in GitHub Desktop.
Save goblindegook/8daabea25da8c696205d to your computer and use it in GitHub Desktop.
(Ubuntu) Compile Nginx from sources with the SSL, SPDY, naxsi, ngx_pagespeed and ngx_cache_purge modules.
#!/bin/sh
NAXSI_VERSION=0.54rc3
NGX_PAGESPEED_VERSION=1.9.32.6
NGX_CACHE_PURGE_VERSION=2.3
NGINX_VERSION=1.9.5
sudo apt-get install \
autoconf \
build-essential \
libcurl4-openssl-dev \
libpcre3 \
libpcre3-dev \
libssl-dev \
libtool \
libxml2-dev \
unzip
mkdir -p ~/src
cd ~/src
wget https://github.com/nbs-system/naxsi/archive/${NAXSI_VERSION}.tar.gz
tar -zxvf ${NAXSI_VERSION}.tar.gz
wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NGX_PAGESPEED_VERSION}-beta.zip
unzip release-${NGX_PAGESPEED_VERSION}-beta.zip
cd ngx_pagespeed-release-${NGX_PAGESPEED_VERSION}-beta
wget https://dl.google.com/dl/page-speed/psol/${NGX_PAGESPEED_VERSION}.tar.gz
tar -xzvf ${NGX_PAGESPEED_VERSION}.tar.gz
cd ..
wget http://labs.frickle.com/files/ngx_cache_purge-${NGX_CACHE_PURGE_VERSION}.tar.gz
tar -zxvf ngx_cache_purge-${NGX_CACHE_PURGE_VERSION}.tar.gz
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
tar -zxvf nginx-${NGINX_VERSION}.tar.gz
cd nginx-${NGINX_VERSION}
./configure \
--prefix=/usr/share/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/access.log \
--user=www-data \
--group=www-data \
--without-http_scgi_module \
--without-http_uwsgi_module \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module \
--with-pcre-jit \
--with-ipv6 \
--with-http_ssl_module \
--with-http_gzip_static_module \
--add-module=~/src/naxsi-${NAXSI_VERSION}/naxsi_src \
--add-module=~/src/ngx_pagespeed-release-${NGX_PAGESPEED_VERSION}-beta \
--add-module=~/src/ngx_cache_purge-${NGX_CACHE_PURGE_VERSION}
make
sudo make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment