enonic/apache2

By enonic

Updated over 9 years ago

Image

165

Docker apache2 container

Standard apache2 container based on ubuntu exposes /etc/apache2, /etc/ssl, /var/www/html as volumes and port 80 and 443 as tcp ports.

Create instance

With persistant storage
docker run -d --name frontend-storage enonic/apache2 echo "frontend storage"
docker wait frontend-storage
docker run -d --name frontend -p 80:80 -p 443:443 --volumes-from frontend-storage -h www.example.com enonic/apache2

Without persistant storage
docker run -d --name frontend -p 80:80 -p 443:443 --volumes-from frontend-storage -h www.example.com enonic/apache2

Usage

Generate Enonic XP reverse proxy config
docker exec frontend gen_proxy_conf <remote server adress>:<remote server port> <host name>
Remove vhost config
docker exec frontend rm_vhost_conf <hostname>
Gracefull reload of config
docker exec frontend reload_apache2
Restart service
docker exec frontend apache2ctl restart
test config
docker exec frontend apache2ctl -t
rsync static files from local filesystem

This command syncs files to the containers htdocs ( /var/www/html ). Example command here:

docker run -it --rm  --name frontend-static-file-sync -v /tmp/static-files-target:/newfiles --volumes-from frontend-storage -h frontend.enonic.io enonic/apache2 sync_static_files
Shell to access persistant storage
docker run -it --rm --name frontend-shell--volumes-from frontend-storage -h www.example.com enonic/apache2 bash
Configuring vhosts for linked containers

All vhost configurations than connects to a linked container has to be generated at startup. This means that for every vhost, we create a template that will be transformed on startup by the launcher script. To generate a templete for the domain, simply run the gen_linking_proxy_conf <domain name> command eiter by docker exec or trough shell access to the persistant storage volume

Create vhost template

docker exec frontend  gen_linking_proxy_conf <servername>

Delete vhost template

docker exec frontend  rm_linking_proxy_conf

Docker Pull Command

docker pull enonic/apache2