0

I have two Magento 2 instances in my Virtualbox ubuntu server. 1st one is new installation magento2.3 located at /var/www/html/, it is working fine and accessible from the browser using IP 127.0.0.1 or localhost

The 2nd instance is a cloned version of production site Magento 2.2.9, located at /var/www/html2/. I'm able to run bin/magento commands from the command line, however, I'm not able to access the site from the browser.

How do I modify the configuration file for hosts at /etc/apache2/sites-available/ to work with multiple Magento sites?

/etc/apache2/sites-available/newsite.conf

<VirtualHost *:80>
            ServerAdmin webmaster@admin.com
            ServerName localhost
            DocumentRoot /var/www/html
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost>

/etc/apache2/sites-available/newsite2.conf

<VirtualHost *:80>
        ServerAdmin webmaster@admin.com
        ServerName localhost2
        DocumentRoot /var/www/html2

        <Directory /var/www/html2>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

/etc/hosts

127.0.0.1 localhost
127.0.0.1 localhost2
  • why you are making two html directory , i think you should use one html directory and just add another project name inside html directory for another site and assign virtual host for it . As appache map with html directory that's why its not running html2 in browser – Ansar Husain Nov 6 '19 at 2:58
  • Set up Magento 2.2.9 in /var/www/html/m229 and check it. – Dhaduk Mitesh Nov 6 '19 at 6:29
  • i looked up some tutorials with the above setup, thought that it'll work and looks cleaner. moved it to under /html/ with some permission updates fixed the issue. thanks – Kris Wen Nov 15 '19 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.