Skip to content

Commit

Permalink
Merge pull request #8 from mrdavidlaing/master
Browse files Browse the repository at this point in the history
Update to nginx 1.7.4 (with ssl support)
  • Loading branch information
David Laing committed Oct 23, 2014
2 parents 7c94557 + 893991b commit 8d68d83
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 11 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ https://github.com/cloudfoundry-community/staticfile-buildpack-acceptance-tests
Local development
=================
There are four example apps that should all compile successfully:
There are five example apps that should all compile successfully:
```
cf push staticfile -p test/fixtures/staticfile_app -b https://github.com/drnic/staticfile-buildpack.git
cf push staticfile -p test/fixtures/alternate_root -b https://github.com/drnic/staticfile-buildpack.git
cf push staticfile -p test/fixtures/directory_index -b https://github.com/drnic/staticfile-buildpack.git
cf push staticfile -p test/fixtures/basic_auth -b https://github.com/drnic/staticfile-buildpack.git
cf push staticfile -p test/fixtures/staticfile_app -b https://github.com/cloudfoundry-community/staticfile-buildpack.git
cf push staticfile -p test/fixtures/alternate_root -b https://github.com/cloudfoundry-community/staticfile-buildpack.git
cf push staticfile -p test/fixtures/directory_index -b https://github.com/cloudfoundry-community/staticfile-buildpack.git
cf push staticfile -p test/fixtures/basic_auth -b https://github.com/cloudfoundry-community/staticfile-buildpack.git
cf push staticfile -p test/fixtures/reverse_proxy -b https://github.com/cloudfoundry-community/staticfile-buildpack.git
```
Building Nginx
Expand Down
1 change: 1 addition & 0 deletions bin/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# ------------------------------------------------------------------------------------------------

export APP_ROOT=$HOME
export LD_LIBRARY_PATH=$APP_ROOT/nginx/lib:$LD_LIBRARY_PATH

conf_file=$APP_ROOT/nginx/conf/nginx.conf
if [ -f $APP_ROOT/public/nginx.conf ]
Expand Down
17 changes: 13 additions & 4 deletions bin/build_nginx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ sudo apt-get update
sudo apt-get install -fy build-essential zlib1g-dev

src=~/src
build=/usr/local
build=/app/nginx
target=/vagrant/vendor

rm -rf $build && mkdir -p $build
mkdir -p $src
cd $src

Expand All @@ -29,10 +30,18 @@ wget http://nginx.org/download/nginx-$nginx_version.tar.gz
tar -xvzf nginx-$nginx_version.tar.gz
cd nginx-$nginx_version

./configure --prefix=$build
./configure --prefix=$build --with-http_ssl_module
make
sudo make install

# Remove extras (help, utilities etc)

sudo rm -rf /app/nginx/bin
sudo rm -rf /app/nginx/sbin/nginx.old
sudo rm -rf /app/nginx/include
sudo rm -rf /app/nginx/share

# Archive it all up
mkdir -p $target
cd $build
tar -zcvpf $target/nginx-$nginx_version.tar.gz nginx/
cd /app
tar -zcvpf $target/nginx-$nginx_version.tar.gz nginx/
4 changes: 2 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ build_dir=$1
cache_dir=$2

# Version
nginx_version="1.5.10"
# nginx_version="1.7.4"
#nginx_version="1.5.10"
nginx_version="1.7.4"

compile_buildpack_dir=$(cd $(dirname $0); cd ..; pwd)
compile_buildpack_bin=$compile_buildpack_dir/bin
Expand Down
Empty file.
6 changes: 6 additions & 0 deletions test/fixtures/reverse_proxy/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<html>
<body>
<p>The iframe below should show https://www.google.it/intl/en/policies/?fg=1 proxied via /intl/en/policies</p>
<iframe src="/intl/en/policies"></iframe>
</body>
</html>
37 changes: 37 additions & 0 deletions test/fixtures/reverse_proxy/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
worker_processes 1;
daemon off;

error_log <%= ENV["APP_ROOT"] %>/nginx/logs/error.log;
events { worker_connections 1024; }

http {
log_format cloudfoundry '$http_x_forwarded_for - $http_referer - [$time_local] "$request" $status $body_bytes_sent';
access_log <%= ENV["APP_ROOT"] %>/nginx/logs/access.log cloudfoundry;
default_type application/octet-stream;
include mime.types;
sendfile on;
gzip on;
tcp_nopush on;
keepalive_timeout 30;

server {
listen <%= ENV["PORT"] %>;
server_name localhost;

location /intl/en/policies {
proxy_pass "https://www.google.it/intl/en/policies/?fg=1";
}

location / {
root <%= ENV["APP_ROOT"] %>/public;
index index.html index.htm Default.htm;
<% if File.exists?(File.join(ENV["APP_ROOT"], "nginx/conf/.enable_directory_index")) %>
autoindex on;
<% end %>
<% if File.exists?(auth_file = File.join(ENV["APP_ROOT"], "nginx/conf/.htpasswd")) %>
auth_basic "Restricted"; #For Basic Auth
auth_basic_user_file <%= auth_file %>; #For Basic Auth
<% end %>
}
}
}
Binary file removed vendor/nginx-1.5.10.tar.gz
Binary file not shown.
Binary file modified vendor/nginx-1.7.4.tar.gz
Binary file not shown.

0 comments on commit 8d68d83

Please sign in to comment.