Fórum

Multiple virtual hosts for one community

Ivano Masiero, modificado 12 Anos atrás.

Multiple virtual hosts for one community

New Member Postagens: 15 Data de Entrada: 07/07/10 Postagens Recentes
Hi, is there a way to assign more domains to one community?I'm using Liferay 6.0.6.
Thank you in advance.
thumbnail
Szymon Gołębiewski, modificado 12 Anos atrás.

RE: Multiple virtual hosts for one community

Regular Member Postagens: 246 Data de Entrada: 08/06/09 Postagens Recentes
Why would you need more than one domain for the same content ?
thumbnail
jelmer kuperus, modificado 12 Anos atrás.

RE: Multiple virtual hosts for one community

Liferay Legend Postagens: 1191 Data de Entrada: 10/03/10 Postagens Recentes
Not that I am aware.

You could solve it with mod_proxy / mod_rewrite configuration in apache
Ivano Masiero, modificado 12 Anos atrás.

RE: Multiple virtual hosts for one community

New Member Postagens: 15 Data de Entrada: 07/07/10 Postagens Recentes
I was wondering if I could manage it just by configuring the Tomcat bundled with Liferay (e.g. setting an alias in the server.xml as I usually do when I cofigure the Tomcat virtual host) and, possibly, avoiding the use of an Apache web server.
Btw, the scenario is "www.abc-initiative.org" is configured as public virtual host for "community1" using the Liferay virtual host management, for institutional reason I would need to add "www.abc-campaign.org" pointing to "community1".
That was mentioned also in some past issues/to-dos and I don't if it will be natively supported in Liferay 6.1.

Thank you in advance for your support.
thumbnail
Szymon Gołębiewski, modificado 12 Anos atrás.

RE: Multiple virtual hosts for one community

Regular Member Postagens: 246 Data de Entrada: 08/06/09 Postagens Recentes
If you just want to redirect users from the second domain it is better to do simple redirect in Apache. Remember that when you publish same content under two different domains Google can lower your Page Rank (Duplicate Content)
thumbnail
jelmer kuperus, modificado 12 Anos atrás.

RE: Multiple virtual hosts for one community

Liferay Legend Postagens: 1191 Data de Entrada: 10/03/10 Postagens Recentes
Using an alias in tomcat wont work unless the site is already the default virtual host for that container
Ivano Masiero, modificado 12 Anos atrás.

RE: Multiple virtual hosts for one community

New Member Postagens: 15 Data de Entrada: 07/07/10 Postagens Recentes
Ok, thanks. In my scenario "community1" is not the default virtual host of the Liferay instance. What if I set a new host on the Tomcat, as suggested in

http://www.liferay.com/community/wiki/-/wiki/Main/High+Availability+Guide#section-High+Availability+Guide-Virtual+Hosting

something like:

<Host name="localhost2" debug="0" appBase="webapp2"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>www.abc-initiative.com</Alias>
<Alias>www.abc-campaign.com</Alias>
</Host>

and copy all the content of $TOMCAT_HOME/webapp/ROOT to $TOMCAT_HOME/webapp2/ROOT
thumbnail
jelmer kuperus, modificado 12 Anos atrás.

RE: Multiple virtual hosts for one community

Liferay Legend Postagens: 1191 Data de Entrada: 10/03/10 Postagens Recentes
Liferay will select the community to display based on the hostname so while www.abc-campaign.com will reach liferay it will not know which community to display, so it will default to the default community
thumbnail
Armand Ballaci, modificado 9 Anos atrás.

RE: Multiple virtual hosts for one community

New Member Postagens: 2 Data de Entrada: 14/12/12 Postagens Recentes
It has been a long time since the post but this problem is not yet addressed and i run throug it just now.

I think this is the easiest solution: (6.1.2 EE/CE)

1. Create a virtual host for your community
2. in the liferay database table Virtualhosts remove the index that blocks you from entering a second row with the same layoutId + groupId
3. duplicate that row (obviously changing the id) and modifying the hostname

done!

It should be just as easy to create a hook that modifies the VirtualHostLocalService and the control panel host configuraion page adding an alias for the domain.

Cheers
Armand
thumbnail
David H Nebinger, modificado 9 Anos atrás.

RE: Multiple virtual hosts for one community

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
It is never a good idea to modify the database like this. First you have no idea what the total implications are and second you risk breaking future upgrades (upgrades will often verify and modify a database, but if you've changed it that process can fail leaving you unable to upgrade).

The only real solution would be to use httpd in front and mod_rewrite to change the incoming aliases to the expected value for the liferay virtual host.

Personally I'm thinking it's a bad idea to want or use multiple dns entries for the same vhost site. I'm thinking of the normal use cases, I guess there may be some that don't (i.e. if you used vhost of example.com but want www.example.com, mail.example.com and ftp.example.com to all work as the same vhost, but this even seems like a dumb idea), I just can't think of a valid one.
thumbnail
Nicolas GRUE, modificado 8 Anos atrás.

RE: Multiple virtual hosts for one community

New Member Postagens: 13 Data de Entrada: 20/02/07 Postagens Recentes
David H Nebinger:
I'm thinking of the normal use cases, (...), I just can't think of a valid one.


Here is a real-life example, not so unusual: an intranet portal with an extranet access. Pointing to the same portal or site.
Internal users do not have free access to a public DNS, only internal DNS.

public hostname (reached from the internet) would be "extranet.company.com"
Internal hostname (reached from the private network) would be "intranet.company.private"

I recently was confronted to that (2 times in a couple of weeks, to tell the truth), and still wondering how I wil escape this mess...

... This is "interesting", because in that case, none of the 2 kind of users are able to reach the other hostname, since they are not using the same DNS (so, the "previous redirect" option, is not possible)...
thumbnail
David H Nebinger, modificado 8 Anos atrás.

RE: Multiple virtual hosts for one community

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
Nicolas GRUE:
Internal users do not have free access to a public DNS, only internal DNS.

public hostname (reached from the internet) would be "extranet.company.com"
Internal hostname (reached from the private network) would be "intranet.company.private"


This is a problem of your own making. Seriously.

An internal DNS is one that is totally under your own control. Totally. So sure, you can pick the hard road of using "intranet.company.private" or you can pick the easy road of using "extranet.company.com". Your employees won't care, your sysops guys can go pound sand. You control that dns and you could call the system "liferay.is.awesome" in the DNS and it would resolve internally.
thumbnail
Nicolas GRUE, modificado 8 Anos atrás.

RE: Multiple virtual hosts for one community

New Member Postagens: 13 Data de Entrada: 20/02/07 Postagens Recentes
Well, in many (big) companies, developers (working on one project) and network admins (permanently ) are not exactly working together ! In many cases they even do not have the same employer...
One will always find companies with network and security gurus forcing everyone to comply with their rules and in that case, it will always be developers who will be asked to do "the right thing".... and they have no choice to argue about the "righteousness" of those rules !

Nevertheless,

I thought I would share with youan approach, that seems to work but only for the multi-hostname portal case. (with this approach, one site with many virtual hostname is a total different case). (tested with a 6.1.EE)

First, you will have to switch back to a native standalone config
  • empty web.server.hostname even if you are running the portal behind Apache, load balancers, etc. You can keep web.server.http(s).port if it is useful to you
  • portal instance hostname will have to be "localhost"

Only with that trick, you will be able to see that even with a different hostname, the users navigation is not broken and hostname is maintained after login, switching sites, going to control panel, etc.

After that, you will have to consider your data: contributors insert hyperlinks, most of the time by copying the complete url, with both protocol and hostname. So you would have to update many database tables (or doing this via Liferay APIs), to correct urls "http://hostname/" to "/". ( WikiPage, BlogsEntry, JournalArticle... just to mention the biggest)
And then, you will have to develop as many Listeners "onBeforeCreate / onBeforeUpdate" that will do the same to new and updated assets.

Yes, it is a pain. Yes, if you can, stick to the "one portal - one hostname" policy...