by droc-ventures

GitHub Readme.md

Heroku Buildpack (Nginx + Google Pagespeed)

Buildpack Stack:

  • Nginx 1.9.0 w/ SPDY
  • Google Pagespeed

Heroku Requirement:

  • Cedar-14


  • We use this stack to server static websites built with AngularJS.

Use Buildpack AS-IS

Just add the following to your application Config Variables: BUILDPACK_URL: https://github.com/droc-ventures/heroku-nginx-pagespeed.git.

Compile and Package Nginx Yourself

This script should be excuted via the terminal heroku run bash --app=app-name.

# set starting point
cd ~

# vendor nginx
curl -L http://nginx.org/download/nginx-1.9.0.tar.gz | tar xzv
cd ~/nginx-*
curl -L http://garr.dl.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.bz2 | tar xvj
curl -L http://drocventures.s3.amazonaws.com/heroku/buildpacks/pagespeed- | tar xzv
cd ngx_pagespeed-release-*
curl -L https://dl.google.com/dl/page-speed/psol/ | tar xzv
cd ~/nginx-*
./configure \
    --prefix=/app/vendor/nginx \
    --with-pcre=pcre-8.36 \
    --with-http_ssl_module \
    --with-http_spdy_module \
    --with-http_gzip_static_module \
    --with-http_stub_status_module \
    --with-http_realip_module \
make install

# package nginx
cd /app/vendor/nginx && tar cvzf /tmp/nginx-1.9.0.tar.gz .

Once the package is created, execute the following commands to download it from the dyno.

cd /tmp/
curl https://raw.githubusercontent.com/scottmotte/srvdir-binary/master/srvdir.tar.gz -O
tar -zxvf srvdir.tar.gz


To make our lives easier when we built this package, we created a fresh dyno heroku create and then terminal into it via heroku run bash -a app-name.