docker-wordpress-nginx-fpm-cache-ssl fork
1.3K
Docker file with related scripts and config files to help build a Docker container that runs the following pieces out-of-the-box:
fastcgi-cache and fastcgi_cache_purge.Also, it provides the following optional scripts:
This docker image does not have any DB included, in order to simplify the configuration process. It is recommended to use a separate Mysql docker container and it is very easy to configure.
The docker image comes with the default CMD script - init.sh, which mainly does:
wp-config.php based on the env. variables.It takes five env. variables:
SERVER_NAME - the server name that serves the Wordpress.DB_HOSTNAME - the host name of Mysql DB.DB_DATABASE - the database name of the Mysql DB that Wordpress uses.DB_USER - the Mysql username that accesses to the database.DB_PASSWORD - the password of the Mysql username that accesses to the database.If using docker run CMD to build the container, be sure to use --env to add these variables.
When using docker compose config file docker-compose.yml to build the containers, it would be much simpler. If using link between wordpress and mysql containers, the init.sh script can automatically get the DB access info by using the link environment variables.
Seems that
linkcan only work with version 1 of docker compose config file.
The docker compose config file would be like this.
wordpress:
image: cowfox/docker-wordpress-nginx-fpm-cache-ssl
environment:
SERVER_NAME: "example.com"
ports:
- "80:80"
- "443:443"
links:
# NOTES: Be sure to keep the "alias" as `db`.
# This alias will be used as "prefix" of **exposed ENV. variables** from DB server.
- mysql:db
mysql:
image: mysql:5.7
command:
- /local-db.sh
environment:
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
MYSQL_DATABASE: $DB_DATABASE
MYSQL_USER: $DB_USER
MYSQL_PASSWORD: $DB_PASSWORD
volumes:
# Workaround script for Mac OSX
- ./bash/local-mysql-mac.sh:/local-db.sh
Please note: when linking the mysql DB, be sure to assign it with an alias db, since
init.shscript uses it to load the link environment variables.
When container being built, all the three optional scripts will be copied to /addon/ folder inside the container.
/addon/wp-install-plugins.sh - It helps download a pre-defined list of Wordpress plugins, in the variable PLUGINS. By default, it only has nginx-helper in the list. When using this script, it is recommended to modify this script (you can grab it from Github) and then mount it back to the container when building it./addon/ssl.sh - It helps add existing SSL cert file to Nginx config. The script uses there ENV. variables.
SSL_TRUSTED_CERT_FILE - The file path to the trusted cert file. The path must be inside the container.SSL_CERT_FILE - The file path to the cert file.SSL_CERT_KEY_FILE - The file path to the private key file./addon/letsencrypt/ssl-letsencrypt.sh - It help auto-generate the letsencrypt SSL cert and add to Nginx config. The script uses there ENV. variables.
LE_WEBROOT - The web root that letsencrypt uses. By default, it is /tmp/letsencrypt-auto.LE_INI_FILE - The file path to the ini files that used to generate the SSL cert. By default, it is /letsencrypt-le.ini.LE_ACME_FILE - The file path to the location block of ACME Challenge that letsencrypt uses. By default, it is /nginx-acme.challenge.le.conf.For the file letsencrypt-le.ini and nginx-acme.challenge.le.conf, you can check the Github repo (/config/addon/) for example.
Besides the above scripts and sample files, Github repo also ships with the config files that Nginx uses, like nginx.conf, site config, SSL config, etc. If needed to modify them, just git clone from Github, modify them and then do docker image build on your side.
MIT
Content type
Image
Digest
Size
196.7 MB
Last updated
about 10 years ago
docker pull 6e6a/docker-wordpress-nginx-fpm-cache-ssl