Huff. Finally I was able to setup the 3 tier architecture with Liferay on one machine(Hosted in a Tomcat Server), Apache web server in another machine and Database in the 3rd machine. Well the changes are mainly in Apache web server and though they are not very complex you need a good document which explains things in a simple way. After finishing the setup I thought may be we this information will be useful going forward so decided to share it through my blog.
STEP 1:
Download and install the following, each on a different server:
Server A - Apache 2.2
Server B - Tomcat with Liferay-tomcat-bundle)
This is simple and I would assume that your liferay is up and ready now and you are able to ping liferay and login to that.
STEP 2:
Download and install the mod_jk shared object file into Server A - $Apache_2.2_HOME/modules/
I renamed my mod_jk file so now I have a mod_jk.So in $Apache_2.2_HOME/modules/. After you've installed mod_>jk into the Apache server, you can continue to the next step.
STEP 3:
Create httpd-mod_jk.conf in $Apache_2.2_HOME/conf/extras. Paste these contents into httpd-mod_jk.conf:
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkLogLevel info
JkShmFile logs/jk-runtime-status
Note:
"LoadModule jk_module modules/mod_jk.so" - loads mod_jk.so so that you could use mod_jk arguments.
"JkWorkersFile conf/workers.properties" - specifies location of workers.properties file where the load balancer and any servers involved with the cluster are defined.
STEP 4:
Create workers.properties in $Apache_2.2_HOME/conf/. Paste these contents in there:
Create workers.properties in $Apache_2.2_HOME/conf/. Paste these contents in there:
worker.properties:
worker.list=portal-01,loadbalancer
worker.portal-01.port=8009
worker.portal-01.host=
worker.portal-01.type=ajp13
worker.portal-01.cachesize=10
JkMount /* portal-01
JkMount is a pretty important line and without that you will not see the fruits of the labour that you have put in defining the settings. So don't miss it.
Note:I've designated Server B to be my Liferay server, an in worker.properties I've given Server B a symbolic name (portal-01).
Also make sure that the port and host for each server configuration in workers.properties is consistent with the server itself.
STEP 5:
Modify $Apache_2.2_HOME/conf/extras/httpd-vhosts.conf
Make a backup of httpd-vhosts.conf. The contents of httpd-vhosts.conf should now just consist of:
NameVirtualHost *:80
JkMount /* loadbalancer
This makes it so that anytime the localhost url of Server A is hit, the load balancing mechanism will control whether the user will actually go to Server B. This is a futuristic setting which you can do without. If you forsee a cluster then keep this setting and your acpache will work as a load balancer when you have a cluster of tomcat working.
STEP 6:
In Apache's httpd.conf we need to include our new httpd-mod_jk.conf and our modified httpd-vhosts.conf.
Uncomment the following in $Apache_2.2_HOME/conf/httpd.conf:
#Include conf/extra/httpd-vhosts.conf
Append the following in $Apache_2.2_HOME/conf/httpd.conf:
Include conf/extra/httpd-mod_jk.conf
STEP 7:
Paste this into portal-ext.properties for Tomcat and add the below entries:
web.server.host=
web.server.port=
web.server.display.node=true
I put this setting to check if the request is coming from the app sever all right and not from the cache.The liferay settings are very important for the success of your 3-tier architecture. I struggled quite a bit without this setting and it will be good if you can identify the host with a name because liferay uses these to create the URL.Another thing about apache is that is sometimes does not provide enough information so first use the Test Configuration option the errors are clearly shown here and then you can go ahead and start the apache server from the console.Have a happy time setting up the 3-Tier architecture. Please give in your opinion if there are any issues you found in my instructions.
STEP 1:
Download and install the following, each on a different server:
Server A - Apache 2.2
Server B - Tomcat with Liferay-tomcat-bundle)
This is simple and I would assume that your liferay is up and ready now and you are able to ping liferay and login to that.
STEP 2:
Download and install the mod_jk shared object file into Server A - $Apache_2.2_HOME/modules/
I renamed my mod_jk file so now I have a mod_jk.So in $Apache_2.2_HOME/modules/. After you've installed mod_>jk into the Apache server, you can continue to the next step.
STEP 3:
Create httpd-mod_jk.conf in $Apache_2.2_HOME/conf/extras. Paste these contents into httpd-mod_jk.conf:
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkLogLevel info
JkShmFile logs/jk-runtime-status
Note:
"LoadModule jk_module modules/mod_jk.so" - loads mod_jk.so so that you could use mod_jk arguments.
"JkWorkersFile conf/workers.properties" - specifies location of workers.properties file where the load balancer and any servers involved with the cluster are defined.
STEP 4:
Create workers.properties in $Apache_2.2_HOME/conf/. Paste these contents in there:
Create workers.properties in $Apache_2.2_HOME/conf/. Paste these contents in there:
worker.properties:
worker.list=portal-01,loadbalancer
worker.portal-01.port=8009
worker.portal-01.host=
worker.portal-01.type=ajp13
worker.portal-01.cachesize=10
JkMount /* portal-01
JkMount is a pretty important line and without that you will not see the fruits of the labour that you have put in defining the settings. So don't miss it.
Note:I've designated Server B to be my Liferay server, an in worker.properties I've given Server B a symbolic name (portal-01).
Also make sure that the port and host for each server configuration in workers.properties is consistent with the server itself.
STEP 5:
Modify $Apache_2.2_HOME/conf/extras/httpd-vhosts.conf
Make a backup of httpd-vhosts.conf. The contents of httpd-vhosts.conf should now just consist of:
NameVirtualHost *:80
JkMount /* loadbalancer
This makes it so that anytime the localhost url of Server A is hit, the load balancing mechanism will control whether the user will actually go to Server B. This is a futuristic setting which you can do without. If you forsee a cluster then keep this setting and your acpache will work as a load balancer when you have a cluster of tomcat working.
STEP 6:
In Apache's httpd.conf we need to include our new httpd-mod_jk.conf and our modified httpd-vhosts.conf.
Uncomment the following in $Apache_2.2_HOME/conf/httpd.conf:
#Include conf/extra/httpd-vhosts.conf
Append the following in $Apache_2.2_HOME/conf/httpd.conf:
Include conf/extra/httpd-mod_jk.conf
STEP 7:
Paste this into portal-ext.properties for Tomcat and add the below entries:
web.server.host=
web.server.port=
web.server.display.node=true
I put this setting to check if the request is coming from the app sever all right and not from the cache.The liferay settings are very important for the success of your 3-tier architecture. I struggled quite a bit without this setting and it will be good if you can identify the host with a name because liferay uses these to create the URL.Another thing about apache is that is sometimes does not provide enough information so first use the Test Configuration option the errors are clearly shown here and then you can go ahead and start the apache server from the console.Have a happy time setting up the 3-Tier architecture. Please give in your opinion if there are any issues you found in my instructions.