Skip to content

Instantly share code, notes, and snippets.

@dfang
Created August 11, 2017 08:32
Show Gist options
  • Select an option

  • Save dfang/ca8a6c96c9bc4a4e8ee1e930267d1a3a to your computer and use it in GitHub Desktop.

Select an option

Save dfang/ca8a6c96c9bc4a4e8ee1e930267d1a3a to your computer and use it in GitHub Desktop.
compile nginx with pagespeed dynamic module support
NPS_VERSION=1.12.34.2-stable
NPS_RELEASE_NUMBER=${NPS_VERSION/stable/}
sudo apt-get update \
&& sudo apt-get install -y unzip \
&& sudo apt-get build-dep nginx=1.13.3 \
&& cd \
&& apt-get source nginx=1.13.3 \
&& cd \
&& wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}.zip \
&& unzip v${NPS_VERSION}.zip \
&& sudo mv ngx_pagespeed-${NPS_VERSION} ngx_pagespeed \
&& cd ngx_pagespeed \
&& 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}) \
&& cd $HOME/nginx* \
&& ./configure --prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--user=nginx \
--group=nginx \
--with-poll_module \
--with-threads \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--add-dynamic-module=$HOME/ngx_pagespeed \
&& make \
&& sudo make install