Set up multiple websites or stores using Magento Cloud Docker
Magento Cloud Docker supports multiple websites or stores by adding subdomains to your Magento configuration. See Understanding websites, stores, and store views.
To add support for multiple websites and stores:
-
Ensure that the
php.ini
file includes the configuration for themagento-vars.php
file:1
auto_prepend_file = /app/magento-vars.php
Magento Cloud Docker applies the configuration in the
php.ini
file to the Docker environment if it is included in the root directory of your project. -
Add each subdomain to the
/etc/hosts
configuration file.1 2
127.0.0.1 magento2.docker 127.0.0.1 second.magento2.docker
After updating the php.ini
file and adding subdomains, start the Docker environment and complete the following tasks to update the website and store configuration from the Magento Admin:
- Add specific stores and websites. See Set up websites, stores, and store views.
- Add the configuration for Magento store and website codes to the
magento-vars.php
. See Modify Magento variables.