LEMP (container stack)

Linux (E)Nginx MariaDB PHP container stack

LEMP stack is a popular open source web platform commonly used to run dynamic web sites and servers. It includes Linux, (E)Nginx, MariaDB (MySQL drop-in replacement), and PHP. It is considered by many, as the platform of choice for development and deployment of high performance web applications which require a solid and reliable foundation.

The TurnKey LEMP container stack is a premade stack, ready for users to host their own apps and easily deploy to the container cloud. It includes a front-facing reverse proxy (Nginx), a database server (MariaDB) and a PHP-FPM container.

A LEPP container stack (providing PostgreSQL database rather than MariaDB) is also available. Other container stacks are coming soon.

This is a stack of 3 separate Docker-style containers with pre-configured interaction between them. Currently it is only available to run on AWS ECS via the AWS Marketplace by following this link:

Subscribe to TurnKey LEMP Container stack on AWS Marketplace

Note AWS account required & usage fees apply.


The database is automatically initialized for the respective application and the front-facing webserver (Nginx) automatically picks up the required virtual host from /etc/turnkey/vhosts volume.

NOTE: when deploying your own applications on top of LEMP, take care to use "" and NOT "localhost" as MySQL/MariaDB server host. This is important due to the technical limitations of MySQL/MariaDB.

Environment variables:

INIT_URL: URL of initialization bootstrap file. Can be one of:
    - a .tar.gz archive to be unpacked to /var/www/html
    - a Git repo to clone to /var/www/html
    - a .sh script to execute in /var/www/html

INIT_POST: command to execute after initialization with INIT_URL finishes.
PURGE_BOOTSTRAP: if set to yes, bootstrap tools (curl and git) will be purged before launching the payload.

GIT_BRANCH: optional branch if other than "master"
CURL_OPTS: optinal arguments to curl (which is used to download bootstrap)

NO_STDOUT_REDIR: write to /var/log/nginx/access.log instead of the container's stdout
NO_STDERR_REDIR: write to /var/log/nginx/error.log instead of the container's stderr

MYSQL_ROOT_PASSWORD: password to set for the "root" user. If unset, will be randomly generated and echoed to logs.
MYSQL_ROOT_ONETIME_PASSWORD: whether to ask root to reset their password on first login.
MYSQL_ONETIME_PASSWORD: whether to ask DB_USER to reset their password on first login.
MYSQL_INITDB_SKIP_TZINFO: whether to skip tzinfo when booting mysqld.

DB_NAME: name of database the application uses; default is application name
DB_USER: name of database user of the application; default is application name
DB_PASS: password used by the application to access the database; default is randomly generated and automatically
         shared between the app