mirror of
https://github.com/dokku/buildpack-nginx.git
synced 2025-06-26 18:40:45 +00:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
d1cccfc747 | |||
ccbb3d7ed5 | |||
61c95d52d8 | |||
805e24be7f | |||
624cd06847 | |||
7a023ab687 | |||
69e450813e | |||
b1370b9c56 | |||
caa17b7718 | |||
9da922ee28 | |||
56bd6c514d | |||
23e4a8ab42 | |||
ebbc9098d9 | |||
1955dcaa72 | |||
29bc30b8d3 | |||
969446ca04 |
@ -9,7 +9,10 @@ This buildpack has been successfully run on Digital Ocean instances of Ubuntu 14
|
|||||||
2. Add another, *empty* file called `.static` to your root directory of your web project. It signals that this buildpack shall be used
|
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
|
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.
|
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. You can also override the nginx root by setting `$NGINX_ROOT`
|
||||||
|
|
||||||
## Credits and License
|
## 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
|
`buildpack-nginx` is licensed under the CC0 1.0 Universal license and has been informed by many similar projects on the web
|
||||||
|
21
bin/compile
21
bin/compile
@ -26,6 +26,8 @@ if [[ ! -e "$BUILD_DIR/www" ]]; then
|
|||||||
mv $BUILD_DIR/* $CACHE_DIR/www
|
mv $BUILD_DIR/* $CACHE_DIR/www
|
||||||
mkdir -p $BUILD_DIR/www
|
mkdir -p $BUILD_DIR/www
|
||||||
mv $CACHE_DIR/www/* $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
|
[[ -f "$BUILD_DIR/www/CHECKS" ]] && mv $BUILD_DIR/www/CHECKS $BUILD_DIR
|
||||||
rm -rf $CACHE_DIR/www
|
rm -rf $CACHE_DIR/www
|
||||||
fi
|
fi
|
||||||
@ -114,11 +116,18 @@ EOF
|
|||||||
|
|
||||||
cd $CUR_DIR
|
cd $CUR_DIR
|
||||||
|
|
||||||
# build nginx config unless overridden by user
|
|
||||||
#if [ ! -f $BUILD_DIR/nginx/nginx.conf ] ; then
|
# Test for user override on nginx config...
|
||||||
echo "-----> using default nginx.conf.erb"
|
if [ -f $BUILD_DIR/nginx.conf.erb ] ; then
|
||||||
cp conf/nginx.conf.erb $BUILD_DIR/nginx/nginx.conf.erb
|
echo "-----> using user provided nginx.conf.erb"
|
||||||
#fi
|
cp $BUILD_DIR/nginx.conf.erb $BUILD_DIR/nginx/nginx.conf.erb
|
||||||
|
#rm $BUILD_DIR/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
|
# build mime.types unless overridden by user
|
||||||
#if [ ! -f $BUILD_DIR/mime.types ] ; then
|
#if [ ! -f $BUILD_DIR/mime.types ] ; then
|
||||||
@ -131,6 +140,6 @@ cat <<EOF >"$BUILD_DIR/start_nginx"
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
rm -f /app/nginx/nginx.conf
|
rm -f /app/nginx/nginx.conf
|
||||||
erb /app/nginx/nginx.conf.erb > /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
|
EOF
|
||||||
chmod +x "$BUILD_DIR/start_nginx"
|
chmod +x "$BUILD_DIR/start_nginx"
|
||||||
|
@ -13,7 +13,11 @@ http {
|
|||||||
server {
|
server {
|
||||||
listen <%= ENV["PORT"] %>;
|
listen <%= ENV["PORT"] %>;
|
||||||
server_name _;
|
server_name _;
|
||||||
root /app/www;
|
<% if ENV["NGINX_ROOT"] %>
|
||||||
|
root /app/www/<%= ENV["NGINX_ROOT"] %>;
|
||||||
|
<% else %>
|
||||||
|
root /app/www;
|
||||||
|
<% end %>
|
||||||
index index.html;
|
index index.html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user