Skip to content

Instantly share code, notes, and snippets.

@aivarasko
Created July 3, 2019 19:07
Show Gist options
  • Select an option

  • Save aivarasko/43b9e9b7ced44e8dbbc729c7f3e13663 to your computer and use it in GitHub Desktop.

Select an option

Save aivarasko/43b9e9b7ced44e8dbbc729c7f3e13663 to your computer and use it in GitHub Desktop.
NGINX
sudo apt install curl gnupg2 ca-certificates lsb-release
echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
sudo apt-key fingerprint ABF5BD827BD9BF62
sudo apt update
sudo apt install nginx
PageSpeed
apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip libssl-dev libuuid1 uuid-dev
export NGINX_VERSION=1.16.0
export NPS_VERSION=1.13.35.2-stable
cd
wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}.zip
unzip v${NPS_VERSION}.zip
cd incubator-pagespeed-ngx-${NPS_VERSION}/
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})
cd
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
tar -xvzf nginx-${NGINX_VERSION}.tar.gz
cd nginx-${NGINX_VERSION}/
# ./configure --add-dynamic-module=$HOME/ngx_pagespeed-${NPS_VERSION} + nginx -V params
./configure --add-dynamic-module=$HOME/incubator-pagespeed-ngx-${NPS_VERSION} --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'
make
cp ./objs/ngx_pagespeed.so /usr/lib/nginx/modules/
mkdir /var/ngx_pagespeed_cache
chown www-data:www-data /var/ngx_pagespeed_cache
nginx -t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment