TurnKey Linux Virtual Appliance Library

Multiple Host Setup for Magento?

L. Arnold's picture

I am trying to get my Magento install to respond variably to different "host" calls.

Domain1.com  is working as needed

Magento however will host multiple Websites and Store Views but the "understanding" of the Host Call is needed.

I have set Domain2.com to resolve to the same IP, and the first view of the site shows the home page of Domain1.com (with the URL of Domain2.com). 

However, because I have set Domain2.com to only show a select set of products, I can see immediately that the host response is not working with the display of Domain1.com and subsequent links going to Domain1.com and domain1 URLs.

I have tried to set up a Virtual Host in Webmin with the name of Domain2.com pointing to the Root Magento Folder.  This does not seem to do what I am looking for - at least not yet.

I am working behind a "firewall" - in the DMZ (Pix 515) and I do notice that Linux often is not "aware" of a "fully qualified domain name"  (not sure how to set this correctly)... I see this variably during startup and shutdown.  I will try a PIX HOST entry next to see if that helps but would like it if this could all be done through WebMin.  There are several variations on Hosts that I would like to set up.  I have done this before without problem in CPanel hosted installs.

A google search on the subject showed this link for Virtualmin in Webmin that seems promising, but I would like to be sure I proceed carefully: 

http://www.webmin.com/vdownload.html

Also the following link has a good explanation of the situation:

http://doxfer.webmin.com/Webmin/Name-BasedVirtualHosting

In the real world, it is rare to only operate one website on a machine. For all but the most demanding websites, it would be a waste of resources to do so, because a single modest computer can serve hundreds or thousands of web requests every minute without much effort. It would also be a waste of the finite IP space on the Internet, as there is a fixed number of IP addresses available and large swaths of them are already in use. To solve both problems Apache provides a feature known as name-based virtual hosts. With name-based virtual hosts, you may serve hundreds or thousands of websites, each with their own domain name, from a single machine running on a single IP! 

Based on the following (about fully qualified domain names) it looks like perhaps the "Magento" Host name that TKL sets up should be changed to its actual domain name (via Apache in Webmin?) -- but where to from there, and also, is VirtualMin even needed if the Virtual Hosts can be properly configured in Apache already: 

http://www.virtualmin.com/documentation/installation/automated#fqdn

thanks in advance for thoughts and help.

Have you check the official docs about it?

I haven't use magento never in my life, but maybe you are looking to do this:

 

http://www.magentocommerce.com/knowledge-base/entry/overview-how-multiple-websites-stores-work/

Have you read that documentation?

L. Arnold's picture

I will check the citation.. I think it is an Apache issue thoug

I have set up Magento the same way it has worked on a cpanel host.  I think the variable is in how the host files are defined in TKL Apache.

Basically wanting to have 2 (or more) "host setups" for that point to Magento.  Magento needs to know what "url" (as opposed to ip) is pointing to them, so that it can then put out different output.

This way one store could present one set of categories and home page, while another store could put out another.

I will check your link, but any guidance on how to Configure the Webmin\Apache\and "Fully Qualified Domain Name" setup is what I think is needed.

thanks for your note.

L. Arnold

There is a ServerName directive

For each VirtualHosts block, you have a ServerName directive where you can write your FQDN so that when you access apache using that domain, those settings are going to be used. 

<VirtualHost *:80>

    ServerName   www.myurl.com

    ......

</VirtualHost>

L. Arnold's picture

Sites Available (default Magento vs New Creations?)

in /etc/apache2/sites-available

Magento (created by TKL 11.1 or 11 -not sure)

The setup is more elaborate. If new Virtual Host is created in Webmin, the new Host has a very simple setup, without the nice outline that the Magento Host has...

I did try having the "Magento" host also resolve to the primary domain name, but this does not seem to change anything.  All hits to the site end up getting the "Magento Host" web view.

Thinking that the quickest fix might be to load a second (etc) IP.  It would be nice to get this all working just based on hostnames.

Is the Magento Host Name basically taking anything that shoots at the Server?  It seems so.

 

L. Arnold's picture

Is default "Magento" Host Name something that should be changed?

I have had several attempts at resolving a secondary hostname on Magento box but no luck.  Wondering if changing the "Magento" Host Name would help.  Since "Magento" by itself is not FQDN (Fully Qualified Domain Name) perhaps it is toggling off the full capability.

Alternatively, is there a way to get a "second" Magento Website (defined from within Magento Admin) to simply be a SubFolder that is generated by Magento?  I have tried this as well, but again, with no luck.

Final Alternative, serving a separate IP address from the same box to get Magento to react to.  The IP is pingable, but I cannot get Magento to react to it.

Has anyone gotten TKL Hosts (particularly Magento) to be hostname responsive? 

Did you find an answer?

Hi L,

Just downloaded and installed TKL Magnento and have the same question. It's been a couple of years since your last post on this issue, wondering if you ever figured this out?

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)