Multi Site PHP-Apache Container

I’ve been trying to build a multi site Apache-PHP docker. Means multiple site hosted in a single docker. Need help on this. The issue has been posted in StackOverflow.

Multi Site PHP-Apache docker

Hello

My personal experience : don’t.

One site is one application and each application has his own Dockerfile / docker-compose.yml.

Running all these containers on the same external network so each site can access the others.

My use case : I’ve two php backend applications, accessible using REST API and one application for the frontend (VueJs) Three applications, three projects, three repos, three docker,…

2 Likes

And then place a reverse proxy like nginx-proxy or Traefik (example) in from of multiple PHP containers. Nginx/Traefik can auto-discover containers via env/label and take care of TLS.

1 Like

Good news is I’ve found the solution. What I did was,

  • Updated to <VirtualHost *:80>. ServerName directive used instead to separate the sites.
  • Deleted the 000-default.conf & default-ssl.conf
  • No need to add ServerName in apache2.conf
    Updated code now available in GitHub - abmmhasan/localhost