Sign inSign up

rarfaoui/apache24_php56

By rarfaoui

Updated about 10 years ago

Apache/2.4.7 (built Jul 15 2016) with PHP 5.6.23 on Ubuntu 14.04

Image
0

924

rarfaoui/apache24_php56 repository overview

** 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:

  • 127.0.0.1 site1.domain.com site2.domain.com

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.

  • mkdir -p /srv/www/docker-data && sudo chgrp www-data -R /srv/www/docker-data

Create two folder inside docker-data:

  • mkdir -p /srv/www/docker-data/site1 /srv/www/docker-data/site2

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:

  • sudo chgrp www-data -R /srv/www/docker-data

Now let's create and run the image:

  • docker build -t rarfaoui/apache24_php56 .
  • docker run -ti -p 8080:80 -p 4431:443 -v /srv/www/docker-data:/srv/www/public --name=apache24_php56 rarfaoui/apache24_php56 /bin/bash

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)

Tag summary

Content type

Image

Digest

Size

240.2 MB

Last updated

about 10 years ago

docker pull rarfaoui/apache24_php56