Foren

Need help with virtual host configuration

Klaus Bachmaier, geändert vor 7 Jahren.

Need help with virtual host configuration

Regular Member Beiträge: 223 Beitrittsdatum: 30.09.13 Neueste Beiträge
We want to host a public website as well as a closed intranet for the same company on the same Liferay Server. I would like to achieve this with only one "company" (aka. portal), because we want to share some content between both websites. We are on Liferay 6.2 on Windows behind an IIS, which is configured as a reverse proxy for the two domains

- internet.mycompany.com
- intranet.mycompany.com

intranet.mycompany.com should point to the website "intranet" in Lifery, and internet to the site "internet". The content for "intranet" is mainly on the private pages of the "intranet" site, and the content for the public website "internet" is on the public page of that site.

When a users enters the URL internet.mycompyny.com he should be directed to the public "home" page of the "internet" site (/web/internet/home), but when he enters the URL intranet.mycompany.com, he should be dircted to the first public page of the "intranet" website, which is simply a login form. After login he should be directed to the first private page of that website.

Whatever I try, I can't get this setup to work as expected, mainly because I don't understand how the virtual host and "Home URL" settings in the "portal configuration" section of the control panel plays togehter with the Site URL settings in the site settings.

Currently the setup is like this:

- Virtual Host in Portal Settings is set to a hostname we don't use at all, so that I may use the two URL's mentioned above as "Virtual Host" names in the Site URL settings
- internet.mycompany.com and intranet.mycompany.com are set as virtual host names in the two websites we want to use.

The problem seems to be the Field "Home URL" in the portal settings

- When I enter a "real" URL here, like "/web/internet/home" both domain URL's open the start page of the internet. So "intranet.mycompany.com" doesn't open the intranet website.
- When I leave this field blank, liferay automatically appends "/web/guest/home" to the domain name, and leads the user to the wrong website.

So currently I'm out of ideas on how to configure Liferay to use two different domain names for two different websites in the same portal. Any Ideas on how I should configure Liferay to behave as described above?
Paul Allain, geändert vor 7 Jahren.

RE: Need help with virtual host configuration

Junior Member Beiträge: 77 Beitrittsdatum: 03.09.13 Neueste Beiträge
If I understand you correctly you want the following:

internet.company.com to be the public site
intranet.company .com to be a private site

In this case I would remove all URL entries from the portal settings (as you have done) or just put localhost in there, create a blank site with the public pages URL pointing to internet.company.com and private pages URL pointing to intranet.company.com

Edit:
In case you want two separate sites then put your URLs in the public pages URL of each site and have your intranet site with a sign in portlet in the first public page and other content in the private pages.

You then need to point IIS to the IP of your portal (not sure how the complete setup of IIS is but with Apache2 you'd use mod_jk and workers to tie things in with tomcat backend).

Note that there are many ways of configuring this sort of setup but this is, in my experience, the least painful way of doing it.
Klaus Bachmaier, geändert vor 7 Jahren.

RE: Need help with virtual host configuration

Regular Member Beiträge: 223 Beitrittsdatum: 30.09.13 Neueste Beiträge
Thanks for your answer Paul.

We indeed need two different websites, and I already configured the login page for the intranet website on the first public page of that site. Meanwhile I easily managed to setup a local environment for testing purposes (with domain names in local host file) which exactly works as intended. So something must be wrong with our reverse proxy settings, but that's nothing I could expect any help from this forum.

We are using this setup for a year now, but just with the intranet website active, and until now it worked perfectly (also with ISS as reverse proxy), but with the second domain the problems started.

So I think I'll need to get deeper into IIS configuration. Thanks anyway.
Paul Allain, geändert vor 7 Jahren.

RE: Need help with virtual host configuration

Junior Member Beiträge: 77 Beitrittsdatum: 03.09.13 Neueste Beiträge
That was going to be my next suggestion, to get in the deep end with IIS.

Have a look at pages like this one for some help with that.

All the best
Klaus Bachmaier, geändert vor 7 Jahren.

RE: Need help with virtual host configuration

Regular Member Beiträge: 223 Beitrittsdatum: 30.09.13 Neueste Beiträge
There is just one more thing which comes into my mind, and that's Liferay related:

While we used only one domain on our server, the portal-ext.properties looked like that:

# Server is behind Proxy
web.server.http.port=80
web.server.host=intranet.mycompany.com

web.server.https.port=443
web.server.protocol=https

redirect.url.security.mode=domain
redirect.url.domains.allowed=intranet.mycompany.com,localhost
redirect.url.ips.allowed=127.0.0.1,SERVER_IP,10.0.0.14,SOME_OTHER_IP


I now just added "internet.mycompany.com" to the list in redirect.url.domains.allowed
But what's with web.server.host? Will I have to change this also to work with the second domain?
Paul Allain, geändert vor 7 Jahren.

RE: Need help with virtual host configuration

Junior Member Beiträge: 77 Beitrittsdatum: 03.09.13 Neueste Beiträge
Just remove all web.server.host entries from your properties file, Liferay is multi tenancy and doesn't require you to specify a host name in the properties files , configure IIS and see if it works without any host information in portal-ext.properties.
Klaus Bachmaier, geändert vor 7 Jahren.

RE: Need help with virtual host configuration

Regular Member Beiträge: 223 Beitrittsdatum: 30.09.13 Neueste Beiträge
Unfortunately it doesn't work without the web.server.host entry. While the first request i.e to intranet.mycompany.com works, all subsequent requests "inside the page" just go the IP-Address of the server (with the wrong IP-Port as Liferay is running on 8080), which doesn't allow to distinguish between the websites of Liferay, for example the stylesheet gets loaded like this:

https://10.0.0.24/mycompany-theme/css/main.css

Therefore only "unthemed" pages show up, when I comment out the web.server.host entry from portal-ext.properties.
Paul Allain, geändert vor 7 Jahren.

RE: Need help with virtual host configuration

Junior Member Beiträge: 77 Beitrittsdatum: 03.09.13 Neueste Beiträge
Unfortunately this is IIS specific, we use the same setup as what you have but with Apache2 as a reverse proxy like I explained above, in our case there is no need to specify hosts at the properties files level.

Apache2 is much easier to setup and very well documented so, if it is an option, I recommend you switch to it.
.
ronak vora, geändert vor 4 Jahren.

RE: Need help with virtual host configuration

Junior Member Beiträge: 25 Beitrittsdatum: 26.09.18 Neueste Beiträge
Page Refreshed while created new Message board post thread form Virtual Host
Can anyone have solution ?