# Multi Site PHP-Apache Container

**URL:** <https://forums.docker.com/t/multi-site-php-apache-container/139943>\
**Category:** General\
**Tags:** build, docker-compose\
**Created:** [February 19, 2024, 2:58pm UTC](https://forums.docker.com/t/multi-site-php-apache-container/139943 "2024-02-19T14:58:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abmmhasan](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/abmmhasan/32/45606_2.png) [@abmmhasan](https://forums.docker.com/u/abmmhasan)\
**Post date:** [February 19, 2024, 2:58pm UTC](https://forums.docker.com/t/multi-site-php-apache-container/139943/1 "2024-02-19T14:58:30Z")

</div>

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](https://stackoverflow.com/questions/78005629/multi-site-php-apache-docker)

---

<div class="post-metadata">

**Author:** ![cavo789](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/cavo789/32/61490_2.png) [@cavo789](https://forums.docker.com/u/cavo789)\
**Post date:** [February 19, 2024, 5:31pm UTC](https://forums.docker.com/t/multi-site-php-apache-container/139943/2 "2024-02-19T17:31:14Z")

</div>

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,…

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/bluepuma77/32/32688_2.png) [@bluepuma77](https://forums.docker.com/u/bluepuma77)\
**Post date:** [February 19, 2024, 6:59pm UTC](https://forums.docker.com/t/multi-site-php-apache-container/139943/3 "2024-02-19T18:59:29Z")

</div>

And then place a reverse proxy like [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) or Traefik ([example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-dashboard-letsencrypt)) in from of multiple PHP containers. Nginx/Traefik can auto-discover containers via env/label and take care of TLS.

---

<div class="post-metadata">

**Author:** ![abmmhasan](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/abmmhasan/32/45606_2.png) [@abmmhasan](https://forums.docker.com/u/abmmhasan)\
**Post date:** [March 7, 2024, 2:25pm UTC](https://forums.docker.com/t/multi-site-php-apache-container/139943/4 "2024-03-07T14:25:41Z")

</div>

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](https://github.com/abmmhasan/localhost)
