From f76e1d0d1989482d180a0aaf72eb93f528d17dfb Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Mon, 3 Nov 2014 23:36:08 -0500 Subject: [PATCH 01/37] Initial commit --- bin/compile | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++-- bin/detect | 2 +- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/bin/compile b/bin/compile index e7078dd..5c88631 100755 --- a/bin/compile +++ b/bin/compile @@ -1,8 +1,75 @@ #!/usr/bin/env bash set -e -apt-get update -apt-get -y install nginx +NGINX_VERSION="1.6.2" +NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz" +PCRE_VERSION="8.34" +PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" +ZLIB_VERSION="1.2.8" +ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz" + +if [[ ! -d "${NGINX_TARBALL%.tar.gz}" ]]; then + wget "http://nginx.org/download/${NGINX_TARBALL}" + tar xvzf "${NGINX_TARBALL}" && rm -f "${NGINX_TARBALL}" +fi + +if [[ ! -d "${PCRE_TARBALL%.tar.gz}" ]]; then + wget "http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${PCRE_TARBALL}" + tar xvzf "${PCRE_TARBALL}" && rm -f "${PCRE_TARBALL}" +fi + +if [[ ! -d "${ZLIB_TARBALL%.tar.gz}" ]]; then + wget "http://zlib.net/${ZLIB_TARBALL}" + tar xvzf "${ZLIB_TARBALL}" && rm -rf "${ZLIB_TARBALL}" +fi + +cd "nginx-${NGINX_VERSION}" +mkdir ../nginx +./configure \ + --with-cpu-opt=generic \ + --prefix=../nginx \ + --with-pcre=../pcre-${PCRE_VERSION} \ + --sbin-path=. \ + --pid-path=./nginx.pid \ + --conf-path=./nginx.conf \ + --with-ld-opt="-static" \ + --with-http_spdy_module \ + --with-http_stub_status_module \ + --with-http_gzip_static_module \ + --with-file-aio \ + --with-zlib=../zlib-${ZLIB_VERSION} \ + --with-pcre \ + --with-cc-opt="-O2 -static -static-libgcc" \ + --without-http_charset_module \ + --without-http_ssi_module \ + --without-http_userid_module \ + --without-http_access_module \ + --without-http_auth_basic_module \ + --without-http_autoindex_module \ + --without-http_geo_module \ + --without-http_map_module \ + --without-http_split_clients_module \ + --without-http_referer_module \ + --without-http_proxy_module \ + --without-http_fastcgi_module \ + --without-http_uwsgi_module \ + --without-http_scgi_module \ + --without-http_memcached_module \ + --without-http_empty_gif_module \ + --without-http_browser_module \ + --without-http_upstream_ip_hash_module \ + --without-http_upstream_least_conn_module \ + --without-http_upstream_keepalive_module \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module + +sed -i "/CFLAGS/s/ \-O //g" objs/Makefile + +make +make install + +rm -rf "nginx-${NGINX_VERSION}" BINDIR=$(dirname "$0") diff --git a/bin/detect b/bin/detect index ce643f6..7c91c11 100755 --- a/bin/detect +++ b/bin/detect @@ -2,7 +2,7 @@ set -e if [[ -f $1/.nginx ]]; then - echo "nginx" + echo ".nginx" exit 0 else exit 1 From 46ac74f7f39c98f82dcfe33f3f2fbb5d96201605 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Mon, 3 Nov 2014 23:42:05 -0500 Subject: [PATCH 02/37] CHANGE app root --- bin/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/release b/bin/release index 60f875a..e7fad55 100755 --- a/bin/release +++ b/bin/release @@ -4,5 +4,5 @@ set -e cat << EOF --- default_process_types: - web: erb /app/nginx.conf.erb > /app/nginx.conf && nginx -c /app/nginx.conf + web: erb /app/nginx.conf.erb > /app/nginx.conf && /nginx/nginx -c /app/nginx.conf EOF From 98994ec4366e9f35fb42fca99fcdd960ebf287d9 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 00:14:27 -0500 Subject: [PATCH 03/37] CHANGE paths --- bin/compile | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/bin/compile b/bin/compile index 5c88631..0429877 100755 --- a/bin/compile +++ b/bin/compile @@ -8,26 +8,40 @@ PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" ZLIB_VERSION="1.2.8" ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz" +echo "0 = ${0}" +echo "1 = ${1}" +echo "2 = ${2}" + +BINDIR=$(dirname "$0") +BUILDDIR="${1}" +CACHEDIR="${2}" + +echo "BINDIR = ${BINDIR}" +echo "BUILDDIR = ${BUILDDIR}" +echo "CACHEDIR = ${CACHEDIR}" + +cd $CACHEDIR + if [[ ! -d "${NGINX_TARBALL%.tar.gz}" ]]; then - wget "http://nginx.org/download/${NGINX_TARBALL}" + curl "http://nginx.org/download/${NGINX_TARBALL}" -o "${NGINX_TARBALL}" tar xvzf "${NGINX_TARBALL}" && rm -f "${NGINX_TARBALL}" fi if [[ ! -d "${PCRE_TARBALL%.tar.gz}" ]]; then - wget "http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${PCRE_TARBALL}" + curl "http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${PCRE_TARBALL}" -o "${PCRE_TARBALL}" tar xvzf "${PCRE_TARBALL}" && rm -f "${PCRE_TARBALL}" fi if [[ ! -d "${ZLIB_TARBALL%.tar.gz}" ]]; then - wget "http://zlib.net/${ZLIB_TARBALL}" + curl "http://zlib.net/${ZLIB_TARBALL}" -o "${ZLIB_TARBALL}" tar xvzf "${ZLIB_TARBALL}" && rm -rf "${ZLIB_TARBALL}" fi cd "nginx-${NGINX_VERSION}" -mkdir ../nginx +mkdir $BUILDDIR/nginx ./configure \ --with-cpu-opt=generic \ - --prefix=../nginx \ + --prefix=$BUILDDIR/nginx \ --with-pcre=../pcre-${PCRE_VERSION} \ --sbin-path=. \ --pid-path=./nginx.pid \ @@ -71,16 +85,10 @@ make install rm -rf "nginx-${NGINX_VERSION}" -BINDIR=$(dirname "$0") - -if [[ ! -f $1/nginx.conf.erb ]]; then - cp $BINDIR/../conf/nginx.conf.erb $1/nginx.conf.erb -fi - -if [[ ! -f $1/mime.types ]]; then - cp $BINDIR/../conf/mime.types $1/mime.types +if [[ ! -f $BUILDDIR/nginx.conf.erb ]]; then + cp $BINDIR/../conf/nginx.conf.erb $BUILDDIR/nginx.conf.erb fi -if [[ -e $1/${CUSTOM_BUILD:-custom-build} ]]; then - $1/${CUSTOM_BUILD:-custom-build} "$@" +if [[ ! -f $BUILDDIR/mime.types ]]; then + cp $BINDIR/../conf/mime.types $BUILDDIR/mime.types fi From 02c38102490dbaf566e5e014b7ed5e23f7f99ba9 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 00:28:07 -0500 Subject: [PATCH 04/37] Further changes --- bin/release | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/release b/bin/release index e7fad55..02dda50 100755 --- a/bin/release +++ b/bin/release @@ -1,8 +1,11 @@ #!/usr/bin/env bash set -e +ls -la / +ls -la /app + cat << EOF --- default_process_types: - web: erb /app/nginx.conf.erb > /app/nginx.conf && /nginx/nginx -c /app/nginx.conf + web: erb /app/nginx.conf.erb > /app/nginx.conf && /app/nginx/nginx -c /app/nginx.conf EOF From 46f02564c49bb94a280cb5b563856c0f938ca20f Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 00:31:04 -0500 Subject: [PATCH 05/37] Changed --- bin/release | 3 --- 1 file changed, 3 deletions(-) diff --git a/bin/release b/bin/release index 02dda50..34c2c65 100755 --- a/bin/release +++ b/bin/release @@ -1,9 +1,6 @@ #!/usr/bin/env bash set -e -ls -la / -ls -la /app - cat << EOF --- default_process_types: From 113541efb721a247f41201abdb2101f674074f46 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 01:17:31 -0500 Subject: [PATCH 06/37] Move to www --- bin/compile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bin/compile b/bin/compile index 0429877..a6a53bf 100755 --- a/bin/compile +++ b/bin/compile @@ -8,17 +8,12 @@ PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" ZLIB_VERSION="1.2.8" ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz" -echo "0 = ${0}" -echo "1 = ${1}" -echo "2 = ${2}" - BINDIR=$(dirname "$0") BUILDDIR="${1}" CACHEDIR="${2}" -echo "BINDIR = ${BINDIR}" -echo "BUILDDIR = ${BUILDDIR}" -echo "CACHEDIR = ${CACHEDIR}" +mkdir -p $BUILDDIR/www +mv * $BUILDDIR/www cd $CACHEDIR From 96549c4103a632d848ee5e3ee46743d6cc725fa4 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 01:21:21 -0500 Subject: [PATCH 07/37] Corrected mv --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index a6a53bf..b8ba17f 100755 --- a/bin/compile +++ b/bin/compile @@ -13,7 +13,7 @@ BUILDDIR="${1}" CACHEDIR="${2}" mkdir -p $BUILDDIR/www -mv * $BUILDDIR/www +mv $BUILDDIR/* $BUILDDIR/www cd $CACHEDIR From 8d4667f1c82f4b35ac59718a3aee42406ce936e7 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 01:26:14 -0500 Subject: [PATCH 08/37] mv corrected --- bin/compile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index b8ba17f..a5df010 100755 --- a/bin/compile +++ b/bin/compile @@ -12,8 +12,10 @@ BINDIR=$(dirname "$0") BUILDDIR="${1}" CACHEDIR="${2}" +mkdir -p $CACHEDIR/www_cache +mv $BUILDDIR/* $CACHEDIR/www_cache mkdir -p $BUILDDIR/www -mv $BUILDDIR/* $BUILDDIR/www +mv $CACHEDIR/www_cache/* $BUILDDIR/www cd $CACHEDIR From afe205f1cfcc2cdf575367265d3f088e3bcf5923 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 01:35:10 -0500 Subject: [PATCH 09/37] Switch to sh --- bin/release | 2 +- bin/start.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 bin/start.sh diff --git a/bin/release b/bin/release index 34c2c65..a603236 100755 --- a/bin/release +++ b/bin/release @@ -4,5 +4,5 @@ set -e cat << EOF --- default_process_types: - web: erb /app/nginx.conf.erb > /app/nginx.conf && /app/nginx/nginx -c /app/nginx.conf + web: sh start.sh EOF diff --git a/bin/start.sh b/bin/start.sh new file mode 100644 index 0000000..7846bf4 --- /dev/null +++ b/bin/start.sh @@ -0,0 +1,2 @@ +erb /app/nginx.conf.erb > /app/nginx.conf +/app/nginx/nginx -c /app/nginx.conf \ No newline at end of file From 36c6e73871c0cc81957e182ab74b187fe23d7804 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 09:36:38 -0500 Subject: [PATCH 10/37] Remove start.sh --- bin/release | 2 +- bin/start.sh | 2 -- conf/{nginx.conf.erb => nginx.conf} | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) delete mode 100644 bin/start.sh rename conf/{nginx.conf.erb => nginx.conf} (74%) diff --git a/bin/release b/bin/release index a603236..0f00929 100755 --- a/bin/release +++ b/bin/release @@ -4,5 +4,5 @@ set -e cat << EOF --- default_process_types: - web: sh start.sh + web: echo 's//{${PORT}}/g' && sed -i 's//{${PORT}}/g' /app/nxinx.conf && /app/nginx/nginx -c /app/nginx.conf EOF diff --git a/bin/start.sh b/bin/start.sh deleted file mode 100644 index 7846bf4..0000000 --- a/bin/start.sh +++ /dev/null @@ -1,2 +0,0 @@ -erb /app/nginx.conf.erb > /app/nginx.conf -/app/nginx/nginx -c /app/nginx.conf \ No newline at end of file diff --git a/conf/nginx.conf.erb b/conf/nginx.conf similarity index 74% rename from conf/nginx.conf.erb rename to conf/nginx.conf index 5417ff6..7b2b070 100644 --- a/conf/nginx.conf.erb +++ b/conf/nginx.conf @@ -11,9 +11,9 @@ http { types_hash_max_size 2048; include mime.types; server { - listen <%= ENV['PORT'] %>; + listen ; server_name _; - root <%= ENV.fetch('root', '/app/www') %>; + root /app/www; index index.html; } } From d9177c1cde41a7cd64417396e8c9fc275df61c7e Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 09:41:18 -0500 Subject: [PATCH 11/37] Change cp for .conf --- bin/compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index a5df010..364f8f0 100755 --- a/bin/compile +++ b/bin/compile @@ -82,8 +82,8 @@ make install rm -rf "nginx-${NGINX_VERSION}" -if [[ ! -f $BUILDDIR/nginx.conf.erb ]]; then - cp $BINDIR/../conf/nginx.conf.erb $BUILDDIR/nginx.conf.erb +if [[ ! -f $BUILDDIR/nginx.conf ]]; then + cp $BINDIR/../conf/nginx.conf $BUILDDIR/nginx.conf fi if [[ ! -f $BUILDDIR/mime.types ]]; then From 6571ed1b957a3140e5feefc11d051e8815d82256 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 09:44:37 -0500 Subject: [PATCH 12/37] Changed typo --- bin/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/release b/bin/release index 0f00929..16aaf5f 100755 --- a/bin/release +++ b/bin/release @@ -4,5 +4,5 @@ set -e cat << EOF --- default_process_types: - web: echo 's//{${PORT}}/g' && sed -i 's//{${PORT}}/g' /app/nxinx.conf && /app/nginx/nginx -c /app/nginx.conf + web: echo 's//${PORT}/g' && sed -i 's//${PORT}/g' /app/nginx.conf && /app/nginx/nginx -c /app/nginx.conf EOF From 5c20c665c6d5b57c33b10cd6cf21266ed551ca6a Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 09:48:58 -0500 Subject: [PATCH 13/37] port --- bin/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/release b/bin/release index 16aaf5f..e2b5a04 100755 --- a/bin/release +++ b/bin/release @@ -4,5 +4,5 @@ set -e cat << EOF --- default_process_types: - web: echo 's//${PORT}/g' && sed -i 's//${PORT}/g' /app/nginx.conf && /app/nginx/nginx -c /app/nginx.conf + web: echo 's//$PORT/g' && sed -i 's//$PORT/g' /app/nginx.conf && /app/nginx/nginx -c /app/nginx.conf EOF From a0e955806ecbff2ba08c9d29d6a4724e54ccb4bc Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 22:46:00 -0500 Subject: [PATCH 14/37] Port changed --- bin/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/release b/bin/release index e2b5a04..b8cc966 100755 --- a/bin/release +++ b/bin/release @@ -4,5 +4,5 @@ set -e cat << EOF --- default_process_types: - web: echo 's//$PORT/g' && sed -i 's//$PORT/g' /app/nginx.conf && /app/nginx/nginx -c /app/nginx.conf + web: sed -i "s//$PORT/g" /app/nginx.conf && /app/nginx/nginx -c /app/nginx.conf EOF From 51b16c21751cccb29c2336f4d5eeddfead89f358 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Wed, 5 Nov 2014 22:54:22 -0500 Subject: [PATCH 15/37] Port --- bin/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/release b/bin/release index b8cc966..ccb594c 100755 --- a/bin/release +++ b/bin/release @@ -4,5 +4,5 @@ set -e cat << EOF --- default_process_types: - web: sed -i "s//$PORT/g" /app/nginx.conf && /app/nginx/nginx -c /app/nginx.conf + web: sed -i "s//\$PORT/g" /app/nginx.conf && /app/nginx/nginx -c /app/nginx.conf EOF From 5c959aaad6232ebf514c95ab4cf61d66e9b11248 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Thu, 6 Nov 2014 17:29:41 -0500 Subject: [PATCH 16/37] CHANGE to static compile --- README.md | 15 ++--- bin/compile | 158 +++++++++++++++++++++++++++++------------------- bin/detect | 4 +- bin/release | 12 ++-- conf/nginx.conf | 18 +++--- 5 files changed, 121 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index c5ea1e3..c46edad 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,8 @@ -# NGINX Buildpack +Dokku buildpack: Static Nginx +================================ -**Note**: This has only been tested with [dokku](https://github.com/progrium/dokku) - it may not work elsewhere. +For your static HTML site! -## Structure -* .nginx - File: its presence signals that this buildpack should be used -* www - Folder: holds all files to be served by nginx -* nginx.conf.erb - Optional File: overrides `conf/nginx.conf.erb` -* mime.types - Optional File: overrides `conf/mime.types` -* custom-build - Optional File: executes commands before build is finished. Note that this script does not run in the application root. To execute commands in the application root you must do `cd "$1"`. +Simply use this as the Dokku buildpack for your static repo and push to your Dokku server! -## Environment Variables -* root - Optional: overrides root directory +Make sure you have a file called `.static` in your root folder of your application. \ No newline at end of file diff --git a/bin/compile b/bin/compile index 364f8f0..881ac73 100755 --- a/bin/compile +++ b/bin/compile @@ -1,6 +1,10 @@ #!/usr/bin/env bash +# bin/compile + set -e +set -o pipefail +# Nginx 1.6.2 NGINX_VERSION="1.6.2" NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz" PCRE_VERSION="8.34" @@ -8,84 +12,116 @@ PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" ZLIB_VERSION="1.2.8" ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz" -BINDIR=$(dirname "$0") -BUILDDIR="${1}" -CACHEDIR="${2}" +# parse and derive params +BUILD_DIR=$1 +CACHE_DIR=$2 +CUR_DIR=`cd $(dirname $0); cd ..; pwd` + +mkdir -p $BUILD_DIR $CACHE_DIR -mkdir -p $CACHEDIR/www_cache -mv $BUILDDIR/* $CACHEDIR/www_cache -mkdir -p $BUILDDIR/www -mv $CACHEDIR/www_cache/* $BUILDDIR/www +echo "-----> copy static files to www" +rm -rf $CACHE_DIR/www +mkdir -p $CACHE_DIR/www +mv $BUILD_DIR/* $CACHE_DIR/www +mkdir -p $BUILD_DIR/www +mv $CACHE_DIR/www/* $BUILD_DIR/www +rm -rf $CACHE_DIR/www -cd $CACHEDIR +cd $CACHE_DIR if [[ ! -d "${NGINX_TARBALL%.tar.gz}" ]]; then + echo "-----> download and unzip nginx" curl "http://nginx.org/download/${NGINX_TARBALL}" -o "${NGINX_TARBALL}" - tar xvzf "${NGINX_TARBALL}" && rm -f "${NGINX_TARBALL}" + tar xzf "${NGINX_TARBALL}" && rm -f "${NGINX_TARBALL}" fi if [[ ! -d "${PCRE_TARBALL%.tar.gz}" ]]; then + echo "-----> download and unzip pcre" curl "http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${PCRE_TARBALL}" -o "${PCRE_TARBALL}" - tar xvzf "${PCRE_TARBALL}" && rm -f "${PCRE_TARBALL}" + tar xzf "${PCRE_TARBALL}" && rm -f "${PCRE_TARBALL}" fi if [[ ! -d "${ZLIB_TARBALL%.tar.gz}" ]]; then + echo "-----> download and unzip zlib" curl "http://zlib.net/${ZLIB_TARBALL}" -o "${ZLIB_TARBALL}" - tar xvzf "${ZLIB_TARBALL}" && rm -rf "${ZLIB_TARBALL}" + tar xzf "${ZLIB_TARBALL}" && rm -rf "${ZLIB_TARBALL}" fi cd "nginx-${NGINX_VERSION}" -mkdir $BUILDDIR/nginx -./configure \ - --with-cpu-opt=generic \ - --prefix=$BUILDDIR/nginx \ - --with-pcre=../pcre-${PCRE_VERSION} \ - --sbin-path=. \ - --pid-path=./nginx.pid \ - --conf-path=./nginx.conf \ - --with-ld-opt="-static" \ - --with-http_spdy_module \ - --with-http_stub_status_module \ - --with-http_gzip_static_module \ - --with-file-aio \ - --with-zlib=../zlib-${ZLIB_VERSION} \ - --with-pcre \ - --with-cc-opt="-O2 -static -static-libgcc" \ - --without-http_charset_module \ - --without-http_ssi_module \ - --without-http_userid_module \ - --without-http_access_module \ - --without-http_auth_basic_module \ - --without-http_autoindex_module \ - --without-http_geo_module \ - --without-http_map_module \ - --without-http_split_clients_module \ - --without-http_referer_module \ - --without-http_proxy_module \ - --without-http_fastcgi_module \ - --without-http_uwsgi_module \ - --without-http_scgi_module \ - --without-http_memcached_module \ - --without-http_empty_gif_module \ - --without-http_browser_module \ - --without-http_upstream_ip_hash_module \ - --without-http_upstream_least_conn_module \ - --without-http_upstream_keepalive_module \ - --without-mail_pop3_module \ - --without-mail_imap_module \ - --without-mail_smtp_module - -sed -i "/CFLAGS/s/ \-O //g" objs/Makefile - -make -make install +if [[ ! -f "${CACHE_DIR}/bin/nginx" ]]; then + echo "-----> compile static nginx" + mkdir $BUILD_DIR/nginx + ./configure \ + --with-cpu-opt=generic \ + --prefix=$BUILD_DIR/nginx \ + --with-pcre=../pcre-${PCRE_VERSION} \ + --sbin-path=. \ + --pid-path=./nginx.pid \ + --conf-path=./nginx.conf \ + --with-ld-opt="-static" \ + --with-http_spdy_module \ + --with-http_stub_status_module \ + --with-http_gzip_static_module \ + --with-file-aio \ + --with-zlib=../zlib-${ZLIB_VERSION} \ + --with-pcre \ + --with-cc-opt="-O2 -static -static-libgcc" \ + --without-http_charset_module \ + --without-http_ssi_module \ + --without-http_userid_module \ + --without-http_access_module \ + --without-http_auth_basic_module \ + --without-http_autoindex_module \ + --without-http_geo_module \ + --without-http_map_module \ + --without-http_split_clients_module \ + --without-http_referer_module \ + --without-http_proxy_module \ + --without-http_fastcgi_module \ + --without-http_uwsgi_module \ + --without-http_scgi_module \ + --without-http_memcached_module \ + --without-http_empty_gif_module \ + --without-http_browser_module \ + --without-http_upstream_ip_hash_module \ + --without-http_upstream_least_conn_module \ + --without-http_upstream_keepalive_module \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module + + sed -i "/CFLAGS/s/ \-O //g" objs/Makefile -rm -rf "nginx-${NGINX_VERSION}" + make && make install -if [[ ! -f $BUILDDIR/nginx.conf ]]; then - cp $BINDIR/../conf/nginx.conf $BUILDDIR/nginx.conf -fi + rm -rf $CACHE_DIR/bin && mkdir -p $CACHE_DIR/bin/ + cp -r $BUILD_DIR/nginx/* $CACHE_DIR/bin/ -if [[ ! -f $BUILDDIR/mime.types ]]; then - cp $BINDIR/../conf/mime.types $BUILDDIR/mime.types +else + echo "-----> reuse nginx from cache" + mkdir -p $BUILD_DIR/nginx + cp -r $CACHE_DIR/bin/* $BUILD_DIR/nginx/ fi + +cd $CUR_DIR + +# build nginx config unless overridden by user +#if [ ! -f $BUILD_DIR/nginx/nginx.conf ] ; then +echo "-----> using default nginx.conf.erb" +cp conf/nginx.conf.erb $BUILD_DIR/nginx/nginx.conf.erb +#fi + +# build mime.types unless overridden by user +#if [ ! -f $BUILD_DIR/mime.types ] ; then +echo "-----> using default mime.types" +cp conf/mime.types $BUILD_DIR/nginx/mime.types +#fi + +# build a startup script +cat <"$BUILD_DIR/start_nginx" +#!/usr/bin/env bash +rm -f /app/nginx/nginx.conf +erb /app/nginx/nginx.conf.erb > /app/nginx/nginx.conf +exec nginx -p /app/nginx -c /app/nginx/nginx.conf +EOF +chmod +x "$BUILD_DIR/start_nginx" diff --git a/bin/detect b/bin/detect index 7c91c11..aac4809 100755 --- a/bin/detect +++ b/bin/detect @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -e -if [[ -f $1/.nginx ]]; then - echo ".nginx" +if [[ -f $1/.static ]]; then + echo ".static" exit 0 else exit 1 diff --git a/bin/release b/bin/release index ccb594c..ae45a02 100755 --- a/bin/release +++ b/bin/release @@ -1,8 +1,12 @@ #!/usr/bin/env bash -set -e +# bin/release -cat << EOF +cat </\$PORT/g" /app/nginx.conf && /app/nginx/nginx -c /app/nginx.conf -EOF + web: /app/start_nginx +EOF \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 7b2b070..2189ddb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,16 +4,16 @@ pid nginx.pid; daemon off; events { - worker_connections 768; + worker_connections 768; } http { - types_hash_max_size 2048; - include mime.types; - server { - listen ; - server_name _; - root /app/www; - index index.html; - } + types_hash_max_size 2048; + include mime.types; + server { + listen <%= ENV["PORT"] %>; + server_name _; + root /app/www; + index index.html; + } } From 9dbc484b6cbbaf383cea9b768980640877f9e760 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Thu, 6 Nov 2014 17:32:49 -0500 Subject: [PATCH 17/37] UPDATE Readme --- README.md | 7 +++---- conf/{nginx.conf => nginx.conf.erb} | 0 2 files changed, 3 insertions(+), 4 deletions(-) rename conf/{nginx.conf => nginx.conf.erb} (100%) diff --git a/README.md b/README.md index c46edad..8eacba3 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ -Dokku buildpack: Static Nginx -================================ +# NGINX Buildpack -For your static HTML site! +**Note**: This has only been tested with [dokku](https://github.com/progrium/dokku) - it may not work elsewhere. Simply use this as the Dokku buildpack for your static repo and push to your Dokku server! -Make sure you have a file called `.static` in your root folder of your application. \ No newline at end of file +Make sure you have a file called `.static` in your root folder of your application. diff --git a/conf/nginx.conf b/conf/nginx.conf.erb similarity index 100% rename from conf/nginx.conf rename to conf/nginx.conf.erb From 1ed618d5f3736e05c4082c5cb03e7dd559bab2b7 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Tue, 18 Nov 2014 17:30:12 -0500 Subject: [PATCH 18/37] Update README.md --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8eacba3..0dbd2af 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,17 @@ -# NGINX Buildpack +# NGINX Buildpack for Dokku - Hosting static pages +This buildpack has been successfully run on Digital Ocean instances of Ubuntu 14.04 (Status: Nov 2014). It might also work in different configurations. -**Note**: This has only been tested with [dokku](https://github.com/progrium/dokku) - it may not work elsewhere. +## Purpose +`buildpack-nginx` provides a simple, low overhead way of hosting stages pages and websites on Dokku. Just add the `.env` and `.static` file to the root directory of your website as described below. -Simply use this as the Dokku buildpack for your static repo and push to your Dokku server! +## Usage +1. Add a file with the name `.env` in the root of your directory with the following content: `export BUILDPACK_URL=https://github.com/florianheinemann/buildpack-nginx.git` +2. Add another, *empty* file called `.static` in your root directory of your web project +3. Push your project to Dokku -Make sure you have a file called `.static` in your root folder of your application. +All static files that you want to serve should be in the root directory of your repository. No need to use a seperate `www` folder. `buildpack-nginx` will automatically download the buildpack, download NGINX, compile it, and install it. The next time you push your project, the buildpack will reuse the precompiled binaries. + +## Credits and License +`buildpack-nginx` is licensed under the CC0 1.0 Universal license and has been informed by many similar projects on the web + +[Florian Heinemann](http://twitter.com/TheSumOfAll/) From 6ed8f5fa6dbcb0ab4f49743f32868a4f677c2ce4 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Tue, 18 Nov 2014 19:32:20 -0500 Subject: [PATCH 19/37] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0dbd2af..f9fe33e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # NGINX Buildpack for Dokku - Hosting static pages -This buildpack has been successfully run on Digital Ocean instances of Ubuntu 14.04 (Status: Nov 2014). It might also work in different configurations. +This buildpack has been successfully run on Digital Ocean instances of Ubuntu 14.04 (Status: Nov 2014). It might also work with different configurations. ## Purpose `buildpack-nginx` provides a simple, low overhead way of hosting stages pages and websites on Dokku. Just add the `.env` and `.static` file to the root directory of your website as described below. ## Usage 1. Add a file with the name `.env` in the root of your directory with the following content: `export BUILDPACK_URL=https://github.com/florianheinemann/buildpack-nginx.git` -2. Add another, *empty* file called `.static` in your root directory of your web project +2. Add another, *empty* file called `.static` to your root directory of your web project 3. Push your project to Dokku All static files that you want to serve should be in the root directory of your repository. No need to use a seperate `www` folder. `buildpack-nginx` will automatically download the buildpack, download NGINX, compile it, and install it. The next time you push your project, the buildpack will reuse the precompiled binaries. From 548f6a84d621a1ab189b908f0701de1d81761198 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Sat, 13 Dec 2014 18:28:12 +0100 Subject: [PATCH 20/37] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f9fe33e..62626d2 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # NGINX Buildpack for Dokku - Hosting static pages -This buildpack has been successfully run on Digital Ocean instances of Ubuntu 14.04 (Status: Nov 2014). It might also work with different configurations. +This buildpack has been successfully run on Digital Ocean instances of Ubuntu 14.04 (Status: Dec 2014). It might also work with different configurations. ## Purpose -`buildpack-nginx` provides a simple, low overhead way of hosting stages pages and websites on Dokku. Just add the `.env` and `.static` file to the root directory of your website as described below. +`buildpack-nginx` provides a simple, low overhead way of hosting static pages and websites on Dokku. Just add the `.env` and `.static` file to the root directory of your website as described below. ## Usage 1. Add a file with the name `.env` in the root of your directory with the following content: `export BUILDPACK_URL=https://github.com/florianheinemann/buildpack-nginx.git` From e343961ea8c2581573a489b70b0498dee74be70f Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Sat, 20 Dec 2014 16:53:34 -0800 Subject: [PATCH 21/37] make compatible with dokku checks plugin --- bin/compile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/compile b/bin/compile index 881ac73..896c835 100755 --- a/bin/compile +++ b/bin/compile @@ -25,6 +25,7 @@ mkdir -p $CACHE_DIR/www mv $BUILD_DIR/* $CACHE_DIR/www mkdir -p $BUILD_DIR/www mv $CACHE_DIR/www/* $BUILD_DIR/www +[[ -f "$BUILD_DIR/www/CHECKS" ]] && mv $BUILD_DIR/www/CHECKS $BUILD_DIR rm -rf $CACHE_DIR/www cd $CACHE_DIR @@ -34,13 +35,13 @@ if [[ ! -d "${NGINX_TARBALL%.tar.gz}" ]]; then curl "http://nginx.org/download/${NGINX_TARBALL}" -o "${NGINX_TARBALL}" tar xzf "${NGINX_TARBALL}" && rm -f "${NGINX_TARBALL}" fi - + if [[ ! -d "${PCRE_TARBALL%.tar.gz}" ]]; then echo "-----> download and unzip pcre" curl "http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${PCRE_TARBALL}" -o "${PCRE_TARBALL}" tar xzf "${PCRE_TARBALL}" && rm -f "${PCRE_TARBALL}" fi - + if [[ ! -d "${ZLIB_TARBALL%.tar.gz}" ]]; then echo "-----> download and unzip zlib" curl "http://zlib.net/${ZLIB_TARBALL}" -o "${ZLIB_TARBALL}" @@ -89,7 +90,7 @@ if [[ ! -f "${CACHE_DIR}/bin/nginx" ]]; then --without-mail_pop3_module \ --without-mail_imap_module \ --without-mail_smtp_module - + sed -i "/CFLAGS/s/ \-O //g" objs/Makefile make && make install From 746b5b88eafcdfc6401b2b956287f6c233e8423a Mon Sep 17 00:00:00 2001 From: "Thomas @ BeeDesk" Date: Sat, 3 Jan 2015 12:22:41 -0800 Subject: [PATCH 22/37] Made script only copy web file from root when `www` folder is not available. --- bin/compile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/bin/compile b/bin/compile index 896c835..9bf55f8 100755 --- a/bin/compile +++ b/bin/compile @@ -19,14 +19,16 @@ CUR_DIR=`cd $(dirname $0); cd ..; pwd` mkdir -p $BUILD_DIR $CACHE_DIR -echo "-----> copy static files to www" -rm -rf $CACHE_DIR/www -mkdir -p $CACHE_DIR/www -mv $BUILD_DIR/* $CACHE_DIR/www -mkdir -p $BUILD_DIR/www -mv $CACHE_DIR/www/* $BUILD_DIR/www -[[ -f "$BUILD_DIR/www/CHECKS" ]] && mv $BUILD_DIR/www/CHECKS $BUILD_DIR -rm -rf $CACHE_DIR/www +if [[ ! -e "$BUILD_DIR/www" ]]; then + echo "-----> copy static files to www" + rm -rf $CACHE_DIR/www + mkdir -p $CACHE_DIR/www + mv $BUILD_DIR/* $CACHE_DIR/www + mkdir -p $BUILD_DIR/www + mv $CACHE_DIR/www/* $BUILD_DIR/www + [[ -f "$BUILD_DIR/www/CHECKS" ]] && mv $BUILD_DIR/www/CHECKS $BUILD_DIR + rm -rf $CACHE_DIR/www +fi cd $CACHE_DIR From 92dad3091bfbd524a7228a3b58b5000357a52f7d Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Mon, 5 Jan 2015 15:38:35 -0500 Subject: [PATCH 23/37] Change to PCRE 8.36 --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index 896c835..d87cbbe 100755 --- a/bin/compile +++ b/bin/compile @@ -7,7 +7,7 @@ set -o pipefail # Nginx 1.6.2 NGINX_VERSION="1.6.2" NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz" -PCRE_VERSION="8.34" +PCRE_VERSION="8.36" PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" ZLIB_VERSION="1.2.8" ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz" From 4f3662aaf1df942b9f0f695bc2966682798950e5 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Mon, 5 Jan 2015 15:41:24 -0500 Subject: [PATCH 24/37] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 62626d2..cd3ec6b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # NGINX Buildpack for Dokku - Hosting static pages -This buildpack has been successfully run on Digital Ocean instances of Ubuntu 14.04 (Status: Dec 2014). It might also work with different configurations. +This buildpack has been successfully run on Digital Ocean instances of Ubuntu 14.04 (Status: Jan 2015). It might also work with different configurations. ## Purpose `buildpack-nginx` provides a simple, low overhead way of hosting static pages and websites on Dokku. Just add the `.env` and `.static` file to the root directory of your website as described below. From 56250a7453afe0be510d4d1107fe04d305a296fb Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Sun, 15 Feb 2015 11:54:16 -0500 Subject: [PATCH 25/37] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd3ec6b..dd226ac 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This buildpack has been successfully run on Digital Ocean instances of Ubuntu 14 ## Usage 1. Add a file with the name `.env` in the root of your directory with the following content: `export BUILDPACK_URL=https://github.com/florianheinemann/buildpack-nginx.git` -2. Add another, *empty* file called `.static` to your root directory of your web project +2. Add another, *empty* file called `.static` to your root directory of your web project. It signals that this buildpack shall be used 3. Push your project to Dokku All static files that you want to serve should be in the root directory of your repository. No need to use a seperate `www` folder. `buildpack-nginx` will automatically download the buildpack, download NGINX, compile it, and install it. The next time you push your project, the buildpack will reuse the precompiled binaries. From 969446ca0403a0c8d37d636298ba2dd443d341c0 Mon Sep 17 00:00:00 2001 From: Charles Pritchard Date: Fri, 27 Mar 2015 16:34:46 -0700 Subject: [PATCH 26/37] Use full path of nginx executable --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index e21c7aa..0c712d5 100755 --- a/bin/compile +++ b/bin/compile @@ -125,6 +125,6 @@ cat <"$BUILD_DIR/start_nginx" #!/usr/bin/env bash rm -f /app/nginx/nginx.conf erb /app/nginx/nginx.conf.erb > /app/nginx/nginx.conf -exec nginx -p /app/nginx -c /app/nginx/nginx.conf +exec /app/nginx/nginx -p /app/nginx -c /app/nginx/nginx.conf EOF chmod +x "$BUILD_DIR/start_nginx" From 29bc30b8d3f5d0f88f6ad0d9a92a2303804ac66a Mon Sep 17 00:00:00 2001 From: Paul Caselton Date: Fri, 3 Jul 2015 22:23:06 +0100 Subject: [PATCH 27/37] Check for user defined nginx config --- bin/compile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/compile b/bin/compile index e21c7aa..78c4f7f 100755 --- a/bin/compile +++ b/bin/compile @@ -108,11 +108,17 @@ fi cd $CUR_DIR -# build nginx config unless overridden by user -#if [ ! -f $BUILD_DIR/nginx/nginx.conf ] ; then -echo "-----> using default nginx.conf.erb" -cp conf/nginx.conf.erb $BUILD_DIR/nginx/nginx.conf.erb -#fi + +# Test for user override on nginx config... +if [ -f $BUILD_DIR/nginx.conf.erb ] ; then + echo "-----> using user provided nginx.conf.erb" + cp $BUILD_DIR/nginx.conf.erb $BUILD_DIR/nginx/nginx.conf.erb + +# ...else, force default file +else + echo "-----> using default nginx.conf.erb" + cp conf/nginx.conf.erb $BUILD_DIR/nginx/nginx.conf.erb +fi # build mime.types unless overridden by user #if [ ! -f $BUILD_DIR/mime.types ] ; then From ebbc9098d98589545c3bcdfc5454c585464bfcf2 Mon Sep 17 00:00:00 2001 From: Paul Caselton Date: Sat, 4 Jul 2015 23:04:54 +0100 Subject: [PATCH 28/37] Fixing nginx user override. --- bin/compile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/compile b/bin/compile index 78c4f7f..4833af9 100755 --- a/bin/compile +++ b/bin/compile @@ -26,6 +26,8 @@ if [[ ! -e "$BUILD_DIR/www" ]]; then mv $BUILD_DIR/* $CACHE_DIR/www mkdir -p $BUILD_DIR/www mv $CACHE_DIR/www/* $BUILD_DIR/www + # Check for an copy the nginx conf file override to the build dir + [[ -f "$BUILD_DIR/www/nginx.conf.erb" ]] && mv $BUILD_DIR/www/nginx.conf.erb $BUILD_DIR [[ -f "$BUILD_DIR/www/CHECKS" ]] && mv $BUILD_DIR/www/CHECKS $BUILD_DIR rm -rf $CACHE_DIR/www fi @@ -113,6 +115,7 @@ cd $CUR_DIR if [ -f $BUILD_DIR/nginx.conf.erb ] ; then echo "-----> using user provided nginx.conf.erb" cp $BUILD_DIR/nginx.conf.erb $BUILD_DIR/nginx/nginx.conf.erb + rm $BUILD_DIR/nginx.conf.erb # ...else, force default file else From 23e4a8ab426a8e9b6f773d390ddbf3d1fd838b97 Mon Sep 17 00:00:00 2001 From: Paul Caselton Date: Sat, 4 Jul 2015 23:51:02 +0100 Subject: [PATCH 29/37] Removing rm line --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index 4833af9..eea3478 100755 --- a/bin/compile +++ b/bin/compile @@ -115,7 +115,7 @@ cd $CUR_DIR if [ -f $BUILD_DIR/nginx.conf.erb ] ; then echo "-----> using user provided nginx.conf.erb" cp $BUILD_DIR/nginx.conf.erb $BUILD_DIR/nginx/nginx.conf.erb - rm $BUILD_DIR/nginx.conf.erb + #rm $BUILD_DIR/nginx.conf.erb # ...else, force default file else From caa17b7718de1dbcb3ba360bd08d82c8894bb6e4 Mon Sep 17 00:00:00 2001 From: Paul C Date: Thu, 10 Sep 2015 18:57:55 +0100 Subject: [PATCH 30/37] Testing paths from other pack. --- bin/compile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/compile b/bin/compile index eea3478..adc4a40 100755 --- a/bin/compile +++ b/bin/compile @@ -108,6 +108,12 @@ else cp -r $CACHE_DIR/bin/* $BUILD_DIR/nginx/ fi +# Update the PATH +mkdir -p $BUILD_DIR/.profile.d +cat > $BUILD_DIR/.profile.d/nginx.sh <<"EOF" +export PATH="$PATH:$HOME/nginx" +EOF + cd $CUR_DIR From 69e450813edba6b316328b7f14734c245b8bf9fb Mon Sep 17 00:00:00 2001 From: Blake Kostner Date: Mon, 5 Oct 2015 17:03:08 -0700 Subject: [PATCH 31/37] added ROOT param --- conf/nginx.conf.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf.erb b/conf/nginx.conf.erb index 2189ddb..82e8b4d 100644 --- a/conf/nginx.conf.erb +++ b/conf/nginx.conf.erb @@ -13,7 +13,11 @@ http { server { listen <%= ENV["PORT"] %>; server_name _; - root /app/www; + <% if ENV["ROOT"] %> + root /app/www/<%= ENV["ROOT"] %>; + <% else %> + root /app/www; + <% end %> index index.html; } } From 624cd06847232804881e91ef0b705b7cb29e788b Mon Sep 17 00:00:00 2001 From: Nick Portokallidis Date: Fri, 30 Oct 2015 13:56:00 +0200 Subject: [PATCH 32/37] Add documentation for nginx custom configuration --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index dd226ac..1f5b03a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ This buildpack has been successfully run on Digital Ocean instances of Ubuntu 14 All static files that you want to serve should be in the root directory of your repository. No need to use a seperate `www` folder. `buildpack-nginx` will automatically download the buildpack, download NGINX, compile it, and install it. The next time you push your project, the buildpack will reuse the precompiled binaries. +## NGINX CONFIGURATION +Override default configuration by adding `nginx.conf.erb` in the root directory + ## Credits and License `buildpack-nginx` is licensed under the CC0 1.0 Universal license and has been informed by many similar projects on the web From 12fe84ae6b3e38b93d74cf61e2b128711de027e2 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 4 Dec 2015 09:34:49 -0800 Subject: [PATCH 33/37] Update PCRE version to fix broken compile step --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index 97435ed..f003c9f 100755 --- a/bin/compile +++ b/bin/compile @@ -7,7 +7,7 @@ set -o pipefail # Nginx 1.6.2 NGINX_VERSION="1.6.2" NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz" -PCRE_VERSION="8.36" +PCRE_VERSION="8.38" PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" ZLIB_VERSION="1.2.8" ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz" From 7d773187bba68f7f2cb20ee638a7f624a52c184f Mon Sep 17 00:00:00 2001 From: Kyle Mattimore Date: Wed, 23 Dec 2015 14:14:33 -0500 Subject: [PATCH 34/37] restored ability to use custom mime.types --- bin/compile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/compile b/bin/compile index f003c9f..76bd78a 100755 --- a/bin/compile +++ b/bin/compile @@ -26,8 +26,9 @@ if [[ ! -e "$BUILD_DIR/www" ]]; then mv $BUILD_DIR/* $CACHE_DIR/www mkdir -p $BUILD_DIR/www mv $CACHE_DIR/www/* $BUILD_DIR/www - # Check for an copy the nginx conf file override to the build dir + # Check for a copy the nginx conf file override to the build dir [[ -f "$BUILD_DIR/www/nginx.conf.erb" ]] && mv $BUILD_DIR/www/nginx.conf.erb $BUILD_DIR + [[ -f "$BUILD_DIR/www/mime.types" ]] && mv $BUILD_DIR/www/mime.types $BUILD_DIR [[ -f "$BUILD_DIR/www/CHECKS" ]] && mv $BUILD_DIR/www/CHECKS $BUILD_DIR rm -rf $CACHE_DIR/www fi @@ -130,10 +131,15 @@ else fi # build mime.types unless overridden by user -#if [ ! -f $BUILD_DIR/mime.types ] ; then -echo "-----> using default mime.types" -cp conf/mime.types $BUILD_DIR/nginx/mime.types -#fi +if [ -f $BUILD_DIR/mime.types ] ; then + echo "-----> using user provided mime.types" + cp $BUILD_DIR/mime.types $BUILD_DIR/nginx/mime.types + +else + echo "-----> using default mime.types" + cp conf/mime.types $BUILD_DIR/nginx/mime.types +fi + # build a startup script cat <"$BUILD_DIR/start_nginx" From ce6895ef38b6911fcd4378100f9ba6e5fbc85fa2 Mon Sep 17 00:00:00 2001 From: milanholy83 Date: Tue, 9 Feb 2016 11:28:01 +0100 Subject: [PATCH 35/37] nginx 1.8.1 --- bin/compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index 76bd78a..593befe 100755 --- a/bin/compile +++ b/bin/compile @@ -4,8 +4,8 @@ set -e set -o pipefail -# Nginx 1.6.2 -NGINX_VERSION="1.6.2" +# Nginx 1.8.1 +NGINX_VERSION="1.8.1" NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz" PCRE_VERSION="8.38" PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" From 1cb0e6cc6de16ed7b40d1afe5696c057a4ef1771 Mon Sep 17 00:00:00 2001 From: antoine-duchenet Date: Thu, 5 Jan 2017 15:24:56 +0100 Subject: [PATCH 36/37] Update Zlib to version 1.2.10 --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index 593befe..4af2a4b 100755 --- a/bin/compile +++ b/bin/compile @@ -9,7 +9,7 @@ NGINX_VERSION="1.8.1" NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz" PCRE_VERSION="8.38" PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" -ZLIB_VERSION="1.2.8" +ZLIB_VERSION="1.2.10" ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz" # parse and derive params From 7017589383a9edfec59fdc582fda8a11e23e68be Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Tue, 31 Jan 2017 15:37:00 +0100 Subject: [PATCH 37/37] UPDATE pcre and zlib --- bin/compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index 4af2a4b..12a00b9 100755 --- a/bin/compile +++ b/bin/compile @@ -7,9 +7,9 @@ set -o pipefail # Nginx 1.8.1 NGINX_VERSION="1.8.1" NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz" -PCRE_VERSION="8.38" +PCRE_VERSION="8.40" PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" -ZLIB_VERSION="1.2.10" +ZLIB_VERSION="1.2.11" ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz" # parse and derive params