Skip to content

Commit

Permalink
var
Browse files Browse the repository at this point in the history
  • Loading branch information
ustramooner committed May 16, 2013
1 parent ce8191c commit 0e1bb63
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .profile.d/00-nginx-php.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set default buildpack path.
export PATH="$PATH:/app/vendor/bin:/app/local/bin:/app/vendor/nginx/sbin:/app/vendor/php/bin:/app/vendor/php/sbin:/usr/local/bin:/usr/bin:/bin"
4 changes: 2 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ NGINX_VERSION=1.4.1
LIBMCRYPT_VERSION=2.5.8
LIBMEMCACHED_VERSION=1.0.7
PHP_VERSION=5.4.15
NEWRELIC_VERSION=3.4.5.167
NEWRELIC_VERSION=2.9.5.78
S3_BUCKET=heroku-buildpack-php-ustramooner
# END CONFIG

Expand Down Expand Up @@ -213,7 +213,7 @@ cp ${BUILD_DIR}/vendor/php/php/fpm/status.html ${BUILD_DIR}/status.html
cp $LP_DIR/conf/php.ini ${BUILD_DIR}/vendor/php/php.ini
cp -a $LP_DIR/conf/etc.d ${BUILD_DIR}/vendor/php/
cp $LP_DIR/conf/nginx.conf.erb ${BUILD_DIR}/vendor/nginx/conf/nginx.conf.erb
[ -f ${LP_DIR}/.profile.d/ ] && cp -n ${LP_DIR}/.profile.d/* ${BUILD_DIR}/.profile.d/
cp -n ${LP_DIR}/.profile.d/* ${BUILD_DIR}/.profile.d/
#erb $LP_DIR/conf/nginx.conf.erb > ${BUILD_DIR}/vendor/nginx/conf/nginx.conf

echo "-----> Installing boot script"
Expand Down
34 changes: 25 additions & 9 deletions conf/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,34 @@ http {
include mime.types;
default_type application/octet-stream;
sendfile on;
server_tokens off;
keepalive_timeout 65;
gzip on;
access_log off;
error_log logs/error.log;
proxy_max_temp_file_size 0;
#fastcgi_max_temp_file_size 0;
limit_conn_zone $binary_remote_addr zone=phplimit:1m; # define a limit bucket for PHP-FPM
# don't use server listen port in redirects.
port_in_redirect off;

# set $https only when SSL is actually used.
map $http_x_forwarded_proto $my_https {
default off;
https on;
}

upstream php_fpm {
server unix:/tmp/php-fpm.socket;
}

root /app/;
index index.php index.html index.htm;

server {
listen <%= ENV['PORT'] %>;
server_name _;

root /app/;
index index.php index.html index.htm;

# Some basic cache-control for static files to be sent to the browser
location ~* \.(?:ico|css|js|gif|jpeg|jpg|png)$ {
expires max;
Expand Down Expand Up @@ -53,9 +67,9 @@ http {

# Status. /status.html uses /status
location ~ ^/(status|ping)$ {
include /app/vendor/nginx/conf/fastcgi_params;
fastcgi_param HTTPS on; # force SSL
fastcgi_pass unix:/tmp/php-fpm.socket;
include fastcgi_params;
fastcgi_param HTTPS $my_https if_not_empty;
fastcgi_pass php_fpm;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

Expand Down Expand Up @@ -84,12 +98,14 @@ http {
# # }
#}

include /app/conf/nginx.d/*.conf;

location ~ .*\.php$ {
try_files $uri =404;
limit_conn phplimit 5; # limit to 5 concurrent users to PHP per IP.
include /app/vendor/nginx/conf/fastcgi_params;
fastcgi_param HTTPS on; # force SSL
fastcgi_pass unix:/tmp/php-fpm.socket;
include fastcgi_params;
fastcgi_param HTTPS $my_https if_not_empty;
fastcgi_pass php_fpm;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Expand Down
2 changes: 1 addition & 1 deletion support/ec2-build-php.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
# use AMI ami-04c9306d
# run this script as root on EC2 machine.

## EDIT
export S3_BUCKET="heroku-buildpack-php-ustramooner"
export LIBMCRYPT_VERSION="2.5.8"
Expand All @@ -26,7 +27,6 @@ apt-get -y update
echo "+ Installing build dependencies..."
# install build deps
apt-get -y install g++ \
make \
gcc \
libssl-dev \
libpng-dev \
Expand Down
3 changes: 1 addition & 2 deletions support/set-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ export PHPREDIS_VERSION="2.2.1"
export LIBMEMCACHED_VERSION="1.0.7"
export LIFREETYPE_VERSION="2.4.12"
export MEMCACHED_VERSION="2.1.0"
export NEWRELIC_VERSION="3.4.5.167"
export NEWRELIC_VERSION="2.9.5.78"

export NGINX_VERSION="1.4.1"

export EC2_PRIVATE_KEY=~/.ec2/pk.pem
export EC2_CERT=~/.ec2/cert.pem
export EC2_URL=https://ec2.us-east-1.amazonaws.com

0 comments on commit 0e1bb63

Please sign in to comment.