This is a multi-site setup using Docker, Apache, and PHP to host multiple websites on a single server.
- Docker
- Local Host Configuration
127.0.0.1 a1.example.com 127.0.0.1 a2.example.com
-
Clone Repository:
git clone --recursive https://github.com/ViralOne/Dockerized-Apache-MultiSite.git
Note: This repository uses submodules. Include the
--recursive
flag to clone all necessary submodules. -
Build Docker Container:
docker build -t multisite-apache .
-
Run Docker Container:
docker run -d -p 80:80 multisite-apache
Replace
multisite-apache
with the name of the Docker image. -
Access Sites:
Open your browser and navigate to:
configs/
- Contains Apache site configuration files.site-1/
- Files for the first website (a1.example.com
).site-2/
- Files for the second website (a2.example.com
).
- To add more sites:
- Create a new directory similar to
site-1
andsite-2
. - Add a new Apache configuration file and place it in the
configs/
directory. - Update the hosts file and the Dockerfile accordingly.
- Create a new directory similar to
- Git Submodules:
- Use
git submodule update --init
to initialize all specified submodules & fetch their contents. - Use
git submodule add <REPO> <DIRECTORY>
to add a new submodule.
- Use
- External Repositories Used: