Public | Automated Build

Last pushed: 7 months ago
Short Description
Lightwight Docker image for the latest PHP7-FPM and Nginx (based on Alpine Linux)
Full Description

PHP7-FPM & Nginx Docker Image

Lightwight Docker image for the (latest) PHP7-FPM and Nginx based on Alpine Linux.

Features

  • PHP (version 7)
  • Nginx
  • Memory usage is around 77MB on a simple install.

Installation

make build

Running

Add your website to the folder web and then run:

make run

The following user and group id are used, the files should be set to this:

chown -R 100:101 web

You can modify the Makefile to include params like: -e VIRTUAL_HOST={domain}.com,www.{domain}.com.

Volume structure

  • /usr/html: Webroot

Special Features

Turn on Basic Authentication

To turn on nginx's HTTP basic authentication set an environment variable ENABLE_BASIC_AUTH to true

To create a htpassword file, you can use this:

htpasswd -nb YOUR_USERNAME SUPER_SECRET_PASSWORD >/etc/secrets/htpasswd

Or to Base64 encode and put inside a volume:

htpasswd -nb YOUR_USERNAME SUPER_SECRET_PASSWORD | base64

Change php.ini value

To modify php.ini variable, simply edit php-fpm.conf and add php_flag[variable] = value.

php_flag[display_errors] = on

PHP Modules

List of available modules installed are:

php7-fpm
php7-json
php7-zlib
php7-xml
php7-pdo
php7-phar
php7-openssl
php7-session
php7-gd
php7-iconv
php7-mcrypt
php7-curl
php7-ctype
php7-apcu
php7-pear
php7-imap
php7-pspell
php7-xmlrpc
php7-sqlite3
php7-tidy 
php7-xsl   
php7-intl
php7-bcmath
php7-dom
php7-mbstring
php7-xmlreader

In order to install additional php modules:

docker exec <image_id> apk add <pkg_name>
docker restart <image_name>

Example:

docker exec <image_id> apk add php7-pdo_pgsql
docker restart <image_name>

License

The code and content of the cheat sheet is release under Creative Commons.

Docker Pull Command
Owner
brunosimoes
Source Repository

Comments (0)