Sunday 6 October 2013

Virtual Hosting - Sites/Organizations


Overview

Sites/Organizations Site Virtual Hosting is an extension of the friendly URL functionality of Liferay that allows one or more SITES in a single portal instance to be identified by separate and unique HOST NAMES (DNS entries).
End users type in the name of the host they want to visit into the address bar in browser, and while it APPEARS to the users that they are visiting different web sites, they are in fact being directed to a Single Liferay Server. The Liferay server determines which site to present to the user based on the URL.

Site Virtual Hosting Setup

Step – 1: Host Entries

The first step in using a virtual host to ensure a Domain Name Server (DNS) entry exists for each virtual host you want, and that every one of them point to the IP address of Liferay server.
For testing we can set up test DNS entries on a local machine that maps a host name to the IP address of 127.0.0.1 by editing the hosts file.
On Unix/Linux/Ubuntu machine HOST file exist in “/etc/hosts”
                                                And
On Windows machine HOST file exist in “\windows\system32\drivers\etc”



Step – 2: Liferay Settings

As Administrator, log into Liferay portal instance. Ensure you have access to the "Sites". Go to the Control Panel and Select the site to map the virtual host name.  Click on the “Site Setting” section and then click on the “Site URL” link on the Site Setting page.
On the “Site URL” page, each Site has a “Friendly URL” and “Virtual Hosts” section. Under the “Virtual Hosts” section "Public Pages" and “Private Pages" URL area exist to have their own virtual host name.
Note: Virtual hosts names are optional. You can specify a name for the public pages site only, the private pages site only, or both.

Now in the “Virtual Host” section, configure the Public Pages site URL:
For example www.siteone.com (in my case I am using www.starcj.com)
For example if Friendly URL as /siteone, this means instead of typing the URL
http://localhost:8080/web/siteone” we can map this entire URL with the "www.siteone.com"
(in my case I am using www.starcj.com).
That’s it the Liferay setting is over. 


In Browser

Type the URL as http://www.siteone.com:8080
Note: We have to type the port number along with the URL , which will take us to the desired site means:
            http://localhost:8080/web/siteone to http://www.siteone.com:8080
In my case it is  
            http://localhost:8080/web/starcj to http://www.starcj.com:8080


Remove the Port number from the URL

Approach 1: Using mod_jk Module with Apache

With the help of mod_jk module with Apache, we can easily access site url without Port number
http://www.siteone.com:8080 to http://www.siteone.com

Install Apache Web Server (if already not exist)
Install and configure mod_jk module (if already not exist/configured)

Once Apache, Mod_jk installation/configuration done, we need to configure the URL Apache should pass through the Tomcat in “/etc/apache2/sites-enabled/000-default” and add the following line
<VirtualHost *:80>
            .......................................
            .......................................
           
            JkMount /* ajp13_worker
</VirtualHost *:80>

Note: In my example I am referring the defult “workers.properties” file of mod_jk for Apache.
/etc/libapache2-mod-jk/workers.properties

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker (ajp13)
worker.ajp13_worker.type=ajp13
worker.ajp13_worker.host=localhost
worker.ajp13_worker.port=8009

Now restart the servers (Apache as well as Tomcat Liferay Server)

Approach 2: Changing the Liferay Tomcat Server Port 8080 to 80

Whenever you enter a URL without a port, it defaults to port 80, the standard http port. Change the Tomcat's listening port from 8080 to 80, and you'll be done.

Step:

     1.) Locate server.xml in {Liferay Tomcat installation folder}\ conf \  

     2.) Find following similar statement
             <Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
                                                or
              <Connector port="8080" protocol="HTTP/1.1" 
                          connectionTimeout="20000" redirectPort="8443" />
    3.) About Tomcat’s server.xml file cites it’s runs on port 8080. Change the Connector port=”8080″ port to any other port number.
             
            For example
            <Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
           
            Above statement instruct Tomcat server runs on port 80.

        4.) Edit and save the server.xml file. Restart Tomcat. Done

Finally access the http://www.siteone.com URL in browser without port.  Liferay site  - siteone landing page will open successfully.  In my case it is http://www.starcj.com

15 comments:

  1. The vacation offers on offer are : deemed as a selection of one particular chosen furthermore low cost throughout. These kinds rentals are commonly proudly located at features who definitely are accented through fine-looking shores selling crystal-clear waters, contingency the Pacific Ocean. hotels packages https://hostinglelo.in/

    ReplyDelete
  2. This is a good subject to talk about. Generally when I come across these sort of things I like to post them on Digg. This article probably wont do well with that crowd. Ill take a look around your site though and submit something else. pokemon go xl candy

    ReplyDelete
  3. you possess a wonderful weblog here! do you want to have the invite posts in this little weblog? alienware area51 threadripper

    ReplyDelete
  4. when it comes to free games, i always look for free flash games because they have small file sizes., high authority backlinks

    ReplyDelete
  5. of course cruise ships are expensive but of course the trip is very nice;; สล็อต live22 โปร 100

    ReplyDelete
  6. Affordable tours… […]the time to read or visit the content or sites we have linked to below the[…]… Judi Bola

    ReplyDelete
  7. fertility clinics these days are very advanced and of course this can only mean higher success rates on birth,, find more info

    ReplyDelete
  8. Good post. I be taught one thing more challenging on completely different blogs everyday. It is going to always be stimulating to read content material from other writers and apply a little something from their store. I’d want to use some with the content on my blog whether or not you don’t mind. Natually I’ll offer you a link in your web blog. Thanks for sharing. 마사지

    ReplyDelete
  9. Music began playing any time I opened this website, so frustrating! 스웨디시

    ReplyDelete
  10. Yay google is my world beater helped me to find this great web site ! . 셔츠룸

    ReplyDelete
  11. The year 2013 is about to end, you must be planning to party all night. But, what's a party without music? Similarly, what's a year end without a musical update? Keeping the same in mind, here are the top five Indian Music Artists of 2013, who made the year worth to be called as a musical yea. address

    ReplyDelete
  12. Punitive measures: The government also enacted laws that made the use of or selling of narcotics a punishable offense. Culprits were prosecuted through the due process of law and when found guilty, were sentenced to several years jail term to make the trade unattractive. Besides, properties proved to have been acquired through this illicit business were also confiscated by the government. Dab pens

    ReplyDelete
  13. well is say just Whenever you arrived at our site, the first you should know is you can buy the highest quality and most expensive ipad case, additionally your favorite apple ipad cases as well as ipad add-ons. You will find hundreds types of ipad situation Learn to use explosion game insurance

    ReplyDelete
  14. This is certainly my initial stop by and I really like what I’m seeing. Your weblog is so much fun to look over, quite compelling as well as informative. I’ll undoubtedly recommend it to my friends. Nevertheless, I did have some problem with the commenting. It kept giving me an problem whenever I clicked on publish comment. I hope, that can be fixed. Many thanks 강남가라오케

    ReplyDelete
  15. Sweet web site, super style and design, rattling clean and utilize pleasant. dog training supplies wholesale

    ReplyDelete