From 8312ca3e2d4c17ccc76e12c1df3fb7a7d4fbb420 Mon Sep 17 00:00:00 2001 From: Ric Harvey Date: Wed, 13 Jul 2016 16:49:32 +0100 Subject: [PATCH] Adding new features to control PHP and hide nginx version --- CHANGELOG | 6 +++++- README.md | 33 ++++++++++++++++++--------------- conf/nginx.conf | 2 +- scripts/start.sh | 22 ++++++++++++++++++++++ 4 files changed, 46 insertions(+), 17 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7fbe42d..9a8f988 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,7 +3,11 @@ All notable changes to this project will be documented in this file. ## [Unreleased] ### Added -- Documentation updates to cover PHP modules + +## [0.1.2] - 2016-7-13 +### Added +- Added options to set PHP values @richarvey +- Added default to hide nginx and php version with overrride @richarvey ## [0.1.1] - 2016-6-15 ### Added diff --git a/README.md b/README.md index c52fa80..c26f24f 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ The Docker hub build can be found here: [https://registry.hub.docker.com/u/richa ## Versions | Tag | Nginx | PHP | Alpine | |-----|-------|-----|--------| -| latest | 1.10.1 | 5.6.21 | 3.4 | -| php5 | 1.10.1 | 5.6.21 | 3.4 | +| latest | 1.10.1 | 5.6.23 | 3.4 | +| php5 | 1.10.1 | 5.6.23 | 3.4 | | php7 | 1.10.1 | 7.0.7 | 3.4 | ## Building from source @@ -111,12 +111,6 @@ MYSQL_USER=username MYSQL_PASS=password ``` -### Enable Templating -In order to speed up boot time templating is now disabled by default, if you wish to enable it simply include the flag below: -``` --e TEMPLATE_NGINX_HTML=1 -``` - ### Template anything Yes ***ANYTHING***, any variable exposed by the **-e** flag lets you template your configuration files. This means you can add redis, mariaDB, memcache or anything you want to your application very easily. @@ -127,11 +121,20 @@ All logs should now print out in stdout/stderr and are available via the docker ``` docker logs ``` -### WebRoot -You can set your webroot in the container to anything you want using the -e "WEBROOT=/var/www/html/public" variable. +## Available Configuration Parameters + +The following flags are a list of all the currently supported options that can be changed by passing in the variables to docker with the -e flag. + + - **GIT_REPO** : URL to the repository containing your source code + - **GIT_BRANCH** : Select a specific branch (optional) + - **GIT_EMAIL** : Set your email for code pushing (required for git to work) + - **GIT_NAME** : Set your name for code pushing (required for got to work) + - **SSH_KEY** : Private SSH deploy key for your repository base64 encoded (requires write permissions for pushing) + - **WEBROOT** : change the default webroot directory from /var/www/html to your own setting + - **ERRORS** : set to 1 to display PHP Errors in the browser + - **TEMPLATE_NGINX_HTML** : enable by setting to 1 search and replace templating to happen on your code + - **HIDE_NGINX_HEADERS** : disable by setting to 0 default behavious is to hide nginx + php version in headers + - **PHP_MEM_LIMIT** : Set higher PHP memory limit default is 128 Mb + - **PHP_POST_MAX_SIZE** : Set a larger post_max_size default is 100 Mb + - **PHP_UPLOAD_MAX_FILESIZE** : Set a larger upload_max_filesize default is 100 Mb -### Displaying Errors -If you want to display PHP errors on screen (in the browser) for debugging purposes use this feature: -``` --e ERRORS=1 -``` diff --git a/conf/nginx.conf b/conf/nginx.conf index 899edda..167c1f2 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -29,7 +29,7 @@ http { #keepalive_timeout 0; keepalive_timeout 2; client_max_body_size 100m; - + server_tokens off; #gzip on; include /etc/nginx/sites-enabled/*; diff --git a/scripts/start.sh b/scripts/start.sh index 5de3811..bb660fe 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -47,6 +47,28 @@ else echo php_flag[display_errors] = on >> /etc/php5/php-fpm.conf fi +# Display Version Details or not +if [[ "$HIDE_NGINX_HEADERS" == "0" ]] ; then + sed -i "s/server_tokens off;/server_tokens on;/g" /etc/nginx/nginx.conf +else + sed -i "s/expose_php = On/expose_php = Off/g" /etc/php5/conf.d/php.ini +fi + +# Increase the memory_limit +if [ ! -z "$PHP_MEM_LIMIT" ]; then + sed -i "s/memory_limit = 128M/memory_limit = ${PHP_MEM_LIMIT}M/g" /etc/php5/conf.d/php.ini +fi + +# Increase the post_max_size +if [ ! -z "$PHP_POST_MAX_SIZE" ]; then + sed -i "s/post_max_size = 100M/post_max_size = ${PHP_POST_MAX_SIZE}M/g" /etc/php5/conf.d/php.ini +fi + +# Increase the upload_max_filesize +if [ ! -z "$PHP_UPLOAD_MAX_FILESIZE" ]; then + sed -i "s/upload_max_filesize = 100M/upload_max_filesize= ${PHP_UPLOAD_MAX_FILESIZE}M/g" /etc/php5/conf.d/php.ini +fi + # Very dirty hack to replace variables in code with ENVIRONMENT values if [[ "$TEMPLATE_NGINX_HTML" == "1" ]] ; then for i in $(env)