How to set up multiple websites in apache

The following step helps you to set up multiple in apache. Listed are:

To create websites, stores and store views in the Magento admin

  1. Log in to the magento admin as a official user to create websites, store and store views.
  2. Tap on stores >setting> all stores.
  3. On the store option, select Main Website Store.
  • In Name field, type the name to identify.
  • In code field, enter a unique code.
  • In status field, select disable
  • In sort order, type a elective numerical sort order
  1. Click on save store view.

To create a cache virtual host

  1. Open a virtual host configuration file in the text editor. Root privileges
  2. For example, open /etc/httpd/conf/httpd.conf
  3. Locate the section starting with<VirtualHost *80>.
  4. Create the following virtual host after any offered virtual host.
<VirtualHost *:80>

   ServerName          mylocalsite.com

 DocumentRoot        /var/www/html/magento2/pub/

</VirtualHost>

 <VirtualHost *:80>

   ServerName          french.mylocalsite.com

   DocumentRoot        /var/www/html/magento2/pub/

   SetEnv MAGE_RUN_CODE "french"

   SetEnv MAGE_RUN_TYPE "website"

</VirtualHost>

 <VirtualHost *:80>

   ServerName          german.mylocalsite.com

   DocumentRoot        /var/www/html/magento2/pub/

   SetEnv MAGE_RUN_CODE "german"

   SetEnv MAGE_RUN_TYPE "website"

</VirtualHost>
  1. Save your changes to httpd.conf and exit the text editor
  2. To restart apache:
  • Centos: service httpd restart
  • Ubuntu: service apache 2 restart

To verify your sites

  1. Open the operating system host file
  2. Add the static root in the format:
  • <ip address>French.mylocalsite.com
  • <ip address>german.mylocalsite.com
  1. Go to one of the following browsers

http://mylocalsite.com/admin

http://french.mylocalsite.com/frenchstoreview http://german.mylocalsite.com/germanstoreview

The above mentioned step shows you how to setup multiple websites in apache.

Last Update: April 9, 2018  

February 2, 2018   273   Nandini R    Operations    
Total 0 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook
Twitter
INSTAGRAM
LinkedIn