Docker Community Forums

Share and learn in the Docker community.

Multiple sites inside one container running Apache : vhost from outside?


I would like to run a container with httpd image while hosting multiple websites inside that container. Each website would have a virtual host setup so they can be accessed by a URL from the outside.

Virtual Host configuration inside the container:

I tried to do the setup but all domains from outside always points to the first VirtualHost Block inside the container. It doesn’t get served based on the domain name from outside.

Any help?

For some debugging try:

httpd -S

To determine where/how my virtualhosts were actually being loaded.

If your Apache version is 2.2 or earlier you have to add this line before the VirtualHost definitions:

NameVirtualHost *:80

Hope that helps