In your apache2 you can manage your sites.
Pls navigate to /etc/apache2/sites-available and ‘LS’ list it with ls command.
You should be able to see your default site file ‘000-default.conf’
You can create a similar files for each of your sites and run them on different domains.
- 1st Magento instance on one domain
- 2nd Magento instance on multiple domain names
2.1 3 domain names for 3 languages legend.co.uk for English British, legend.fr for French and
legend.com for English American
- WordPress also on a different domain name
Hypothetically we want to build the above. 2 x Magento instances and one WP.
Let’s start with your application root directory.
Please navigate to /var/www and ‘LS’ (list is with ls command)
See what you have there.
I’m guessing there is html directory with index.htm file in it. We may use it we may rename it/remove it but please ignore it for now.
Please create 3 root directories for our applications running the following command using your superuser account. Make sure that you are in /var/www directory
sudo mkdir magento1 magento2 wp
I skip file permissions. Pls ref. to Craig’s article here if you need it.
Next, navigate to /etc/apache2/sites-available
‘ls’ it. You should see 000-default.conf. Copy it, please.
sudo cp 000-default.conf your1stDomaineName.com.conf
sudo cp 000-default.conf your2ndDomaineName.com.conf
sudo cp 000-default.conf yourWordPressDomaineName.com.conf
Now, you need to edit your newly created files.
Simply replace html with your new application directory (magento1, magento2, wp).
DocumentRoot /var/www/html to /var/www/magento1
ServerName your1stDomaineName.co.uk (for your fist Magento instance)
You should have something like:
At the bottom of the file add
<Directory "/var/www/magento1"> AllowOverride All </Directory>
Close and save.
Ctrl + ‘X’ + 'Y
The last step what you have to do is to enable to file.
sudo a2ensite your1stDomaineName.com.conf
and restart apache running
sudo systemclt restart apache2
You may want to disable the default file. To do so please run
sudo a2dissite 000-default.conf
don’t forget to restart apache
sudo systemctl restart apache2
a2ensite, a2disite - Explenation
a2 = apache2, en=enable, site = self explanatory
a2 = apache2, dis = disable
Now, you have to do it for 2 more sites.
Just replicate the .conf file changing your domain name and root directory.
If I didn’t omit anything you are ready to start installing 3 applications (2 x Magento and one WordPress) parked on 3 different domain names in 3 different locations and they will work.
Look, I am not an expert. I’m still learning. I don’t know how to bite security. 2 x Magento using the same ElasticSearch and so on.
I would refer you to this article - How to set up a single Magento instance on multiple domains.
Remember about file permissions. I skipped it.