Sign inSign up

sysbee/http-php71

By sysbee

•Updated over 2 years ago

Image
0

5.1K

sysbee/http-php71 repository overview

⁠http-php71

⁠Intro

This docker image is based on centos7 and contains standard apache 2.4 install with PHP 7.1 packages required for running most of the popular PHP applications and frameworks.

Image can be used as base for packing application codebase, deploying it via HashiCorp's Nomad or other container orchestration solution.

This can also be used as local development environmet. Most of the setup is standardized by Sysbee default standards and will conform with usual deployment strategy.

⁠Quickstart

Start simple development container

docker run -p 80:80 -it sysbee/http-php71

Expose host volume on custom mount path and set custom user and domain name

docker run -p 80:80 -v $HOME/path/to/codebase:/home/testuser/public_html -e "HTTP_USER_DOMAIN=testdomain.com" -e "HTTP_USER_DOCROOT=/home/testuser/public_html" -it sysbee/http-php71

This will still run PHP FPM pool as apache user, as this container does not have any unix users deployed.

Make note that this container uses apache vhosts, so the codebase will be only accessable if container recieves host header with testdomian.com in it. Otherwise default empty page of /var/www/html doc root will be served

⁠Building other images

To run everything under specific user you can/should build upon this container image

FROM sysbee/http-php71
RUN useradd username
COPY public_html /home/username/public_html
RUN chowqn -R username:username /home/username/public_html

then buld that container image

docker build -t local/php-app .

This will copy entire codebase from public_html (next to that dockerfile) inside new container based on sysbee/http-php71

Let's run a new container now

docker run -p 80:80 -e "HTTP_USER_DOMAIN=testdomain.com" -e "HTTP_USER_DOCROOT=/home/username/public_html" -e "PHP_FPM_USER=username" -it local/php-app

⁠Other available customizations

This container offers some customizations through env variables, if not specified defaults listed bellow will be applied

Port to listen for HTTP conneciton

HTTP_LISTEN=80

Apache TimeOut

HTTP_TimeOut=300

Apache mod_remoteip header

HTTP_RemoteIPHeader=CF-Connecting-IP

Apache mod_remoteip internal proxy addresses

HTTP_RemoteIPInternalProxy="127.0.0.1 10.0.0.0/8 172.31.0.0/16"

Apache vhost domain and document root

HTTP_USER_DOMAIN=localhost
HTTP_USER_DOCROOT=/var/www/html

PHP listen port user and max childs

PHP_FPM_LISTEN=9000
PHP_FPM_USER=apache
PHP_FPM_MAX_CHILDREN=20

PHP.in default settings

PHP_memory_limit=128M
PHP_max_file_uploads=20
PHP_max_execution_time=60
PHP_max_input_time=60
PHP_max_input_vars=5000
PHP_error_reporting="E_ALL & ~E_DEPRECATED & ~E_STRICT"
PHP_post_max_size=20M
PHP_upload_max_filesize=20M
PHP_session.gc_divisor=1000
PHP_session.gc_maxlifetime=1440
PHP_opcache.enable=On
PHP_opcache.memory_consumption=128
PHP_opcache.max_accelerated_files=4000
PHP_opcache.validate_timestamps=On
PHP_opcache.revalidate_freq=20
PHP_opcache.fast_shutdown=1

To allow mailing with mail() function ssmpt is installed in this container set your smtp relay hostname here

SSMTP_MAILSERVER=mail.service.consul

Tag summary

Content type

Image

Digest

sha256:c9406072f…

Size

353.2 MB

Last updated

over 2 years ago

docker pull sysbee/http-php71