Tuesday, April 7, 2015

Liferay Site/Organization Virtual Hosting

Generally in Liferay administration we create sites and organizations and each site and organization have unique URL to access these sites/organizations. Generally we will have friendly URL to access these sites/organizations in Liferay.

Each site/organization has its own friendly URL and it consist pattern like /web and site/organization name. When we see /web in the URL then we can consider that is Site/Organization in Liferay.

Site Example

Site Name:
Site Friendly URL
Complete URL Pattern
Host Name+ Site Friendly URL
Complete URL
http://localhost:8080 /web/liferaysavvy

Organization Example

Site Name:
Site Friendly URL
Complete URL Pattern
Host Name+ Organization Friendly URL
Complete URL
http://localhost:8080 /web/liferaysavvyorg

Generally in real time we won’t use friendly URL to access site/organization we will use unique domain name and that will be pointing to Liferay site/organization.to achieve this we will use Liferay virtual host configuration.

Liferay Virtual Host is way of accessing site/organization with real world domain names. In Production we use apache web server, domain vendor control panel configurations and finally we use Liferay virtual host configuration.

In development environment to replicate same kind of configuration in our local system we will follow some sequence of steps.

Assume we wanted to access our Liferay site/organization with URL like www.liferaysavvy.com  in our local system.

  • Create Site/Organization
  • Configure Site URL with desired domain name www.sitename.com
  • In host file map with your domain name

Liferay Site Virtual Hosting

Create Site

Access Liferay portal and login as Liferay Administration.

Go Control Panel from Admin Docbar.

Control panel we can see site section there click on sites link

Now in the sites page we can see Add button click on Add and select Blank Site

Once we click on Blank site we can see site creation form and it will ask basic details related to site like name and description. Please fill all details and click on save button then site will be created.

After successful site creation then it will navigate to site settings page there we can see many option related to site settings

In site setting page Right site section we can see Site URL link click on site URL then we can have provision to specify our site URL and this is the place we need to provide our desired domain name/site host name.
We have two kinds of pages in Liferay Site Public pages and Private pages. Public pages is can be accessed by all the site users but private pages can be accessed by only the user who is created  it means site admin and site owner can access.

We can provide two distinct Virtual Hosts (URL/Domain Name) for each set of pages. For accessing public pages we can give one Virtual Host (URL/Domain Name) and for private pages we can give other Virtual Host (URL/Domain Name).

When we click on Site URL link then we can have provision to give public pages Virtual Host and Private pages Virtual Host.

We need to provide valid URL/Host Name in Virtual Host input fields then click on save button. Now Our Site can be accessed by given site URL.

 As we know that at time of site creation we have chosen black site so that it does not have any pages.
Liferay site should have at least one page to access with URL now we need to create one site page for our newly created site (LiferaySavvy)

Now in the site Options page Left Site Section you can find Pages menu tab there you can see site pages link. Click on that so that we can create pages for site.

Now select public pages and under this we can create new page by clicking one Add Page option .when we click on Add Page it will open popup there  it will ask required page details. Once we fill detail then click on adds page button in the popup then page will be crated under site public pages section.

New page (home) will be created in the public pages section

Mapping Virtual Host Name with local system IP

This is final step in Liferay Site Virtual Host and here we need to map given Site URL with our Local System IP address (

Generally our local system IP is and we need to map IP with Site URL in the system host file.

In every system OS we have host file there we will configure host names related to our local system. Based on Operating System we can find host file in different locations. Generally it will be under etc directory (etc/host)

For windows this file location as follows


Now open host file in editor and map your Site URL with in the new line in file and finally save the file then mapping will be completed.     www.liferaysavvy.com

Now open your desire browser, in the address bar ping your given Site URL then it will open your Liferay site.


In Development environment we are using only Application servers so we need to append Port number for Site URL when we access from browser.

If Site is already created then we need to access site setting page then follow the above steps to complete Liferay site virtual hosting.

Go to list of sites and select your desired site then click on Actions menu there we can find Site Administration.

Once we click on site administration then we can see configuration in Left side Menu when we click on that we can find site settings. In the Site Setting right side section you can see site URL there you need to enter your desired site URL name. Rest of the steps same as above.

Same way we can also configure virtual host for site private pages. You also follow same steps for Liferay Organizations to configure virtual host.

Popular Posts

Recent Posts

Recent Posts Widget