Apache/2.4.7 (built Jul 15 2016) with PHP 5.6.23 on Ubuntu 14.04
924
** Running multiple websites within docker container ** Video demo available at : http://www.screencast.com/t/7YMtl1z7Q (multiple_websites_docker_container_apache2)
This image contains 2 VirtualHosts example : site1.domains.com and site2.domains.com . The domains should be declared before in your host machine. If your host is a Linux system, then add in /etc/hosts following row:
You should add a persistent volume to share web data between the host and the container, so that you will be able to edit your future code from the host. To avoid Apache Forbidden Error please set the shared folder with www-data user.
Create two folder inside docker-data:
Now just create index.html file inside site1 and site2 folder with Simple "Hello site1" and "Hello site2" Text. don't forget that both index.html files are having www-data as a group or execute this command again:
Now let's create and run the image:
Check if apache is runing within the container if not run (/run.sh) . The file is located in the root file system of the container. This script will enable a https connection to the locahost.
Available URL from the Host
http://site1.domain.com:8080 http://site2.domain.com:8080 http://127.0.0.1:8080 https://127.0.0.1:4431
Take care that port 8080 or 4431 is not using from other application in the host. if yes then choose other ports.
Now you can extend site1 and site2, or add new websites . If you add a new application or CMS instance then add a new Virtualhost in /srv/www/apache2/sites-enabled/
Apache is binding any new VirtualHost from :/etc/apache2/sites-enabled/apache-config.conf site1 and site2 error and access logs are located in /srv/www/logs
Video demo available at : http://www.screencast.com/t/7YMtl1z7Q (multiple_websites_docker_container_apache2)
Content type
Image
Digest
Size
240.2 MB
Last updated
about 10 years ago
docker pull rarfaoui/apache24_php56