Installing M2 on server with another website

  1. Can I go ahead and install M2.4 know or which version is most stable?

  2. My server has a single IP and another domain is active. I need to install M2 as well (has its domain).

I read that you need to configure vhost for multiple sites to work. Now my server has apache, nginx, php-fpm and vanish all working. Do I need to configure the …/conf files for nginx, vanish and apache?

Cheers,

Hi,

Do you want multiple websites powered by one Magento instance?
i.e.

  1. one Magento instance with multiple stores + and/or multiple stores views
  2. multiple Magento instances on one server with multiple stores + and/or multiple stores views

All the above are possible on one server with one ip address.

Pawel

Hello,

Its a dedicated server and powerful to handle ulti9le websites.

I have a billing panel installed on the server and I want to install another domain which I will use for M2.

My question is the right approach to achieve that considering that I have apache, Nginx and vanish all running.

Cheers.

Hi,
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.

i.e.

  1. 1st Magento instance on one domain
  2. 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
  3. 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

cd /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).
i.e.
DocumentRoot /var/www/html to /var/www/magento1

Bellow add
ServerName your1stDomaineName.co.uk (for your fist Magento instance)

You should have something like:

DocumentRoot /var/www/magento1
ServerName your1stDomaineName.co.uk

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.
Simply run

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 :slight_smile:
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.

1 Like

Waoh.
I will implement your approach and let you know how it goes.

Thanks again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.