Sunday, 21 August 2016

Configuring Apache web server with Weblogic and accessing multiple Application with different context root

 Apache is generally recognized as the world's most popular Web server (HTTP server). Originally designed for Unix environments, the Apache Web server has been ported to Windows and other network operating systems. The name "Apache" derives from the word "patchy" that the Apache developers used to describe early versions of their software.

The Apache Web server provides a full range of Web server features, including CGI, SSL, and virtual domains. Apache also supports plug-in modules for extensibility. Apache is free software, distributed by the Apache Software Foundation that promotes various free and open source advanced Web technologies.
In Order to configure Apache with Weblogic Server we need
1.  Weblogic Server domain created with at least 2 managed server in a cluster
2.Apache Installed on the System
3,Plug in based on the Apache Version
Picture














The First thing which we have to do is to download the plugin files from the Oracle Website the latest one is 12c plugins.
Once you download the plugin and unzip it you will find the plugins available for all the Web Server which Weblogic Supports
Based on the Web Server which you are using you many choose the plugin.
In my Demo case we have Apache 2.2 and Win32 bit OS.





Picture














Extract the Plugin in



Picture














Copy the mod_wl file to the Apache modules folder .
Location in Windows
C:\Program Files\Apache Software Foundation\Apache2.2\modules

Now we have to make some configuration changes in the configuration files of Apache .

The most important configuration file of Apache is httpd.conf
Before making any changes please take the backup of the file.

Picture











Open the httpd.conf file and add the below line after copying the mod_wl.so file in modules folder .
The location of httpd.conf file is
C:\Program Files\Apache Software Foundation\Apache2.2\conf

Some time you will not be allowed to edit the httpd.conf file .
Select the file and change the permission of the file and then you will be allowed to save the configuration.

Picture












Now Deploy the some of the same application on Weblogic
We have deployed 3 application
1. Console app on localhost and the port number 7001
2.  ShoppingCart Application on the Cluster (Ms1,Ms2,Ms3)
3.Calendar Application on Cluster (Ms1,Ms2,Ms3)

Make sure the application are in active state.

Picture
Now open the httpd.conf file and we have to add the application context root and the location where the request should be passed .
For accessing the Console using apache
<Location /console>
 SetHandler weblogic-handler
 WebLogicHost localhost
 WebLogicPort 7001
 Debug ALL
</Location>



For Accessing the ShoppingCart application which is deployed on Cluster
<Location /ShoppingCart>
SetHandler weblogic-handler
WebLogicCluster localhost:7003,localhost:7004,localhost:7006
Debug ALL
DebugConfigInfo ON
</Location>
For Accessing the Calendar application which is deployed on Cluster
<Location /Calendar>
SetHandler weblogic-handler
WebLogicCluster localhost:7003,localhost:7004,localhost:7006
Debug ALL
DebugConfigInfo ON
</Location>

Save the configuration and Restart the Apache Web Server

Picture












Now We can access our application via the Apache just by giving the context root and Apache will decide to send the request to the desired managed Server which we have configured in the httpd.conf file.

Hurry we have configured Apache to be used as Web Server and deployed different application and is able to access the application via the Web Server(Apache)



In Order to troubleshoot any issue on Web server we have some parameter and Logs which we use.

Picture














To know all the parameters which are being picked up by the WebServer while accessing the Application we can use the ?__WebLogicBridgeConfig Information Which will let us know all the parameters picked up.
In order to enable this we need to add the following parameter in the httpd.conf file.
DebugConfigInfo On


Picture
Now you will get all the information about the parameters being picked up.
To check the parameter use the below URL
http://localhost/console?__WebLogicBridgeConfig

http://localhost/ShoppingCart?__WebLogicBridgeConfig

Picture













To Get the access logs from Apache We can use the following parameter and we will get the logs to view how the page was rendered.

 Debug ALL
 WLLogFile C:\temp\wlproxy1.log



Picture














You can go and check the log file for any issue and rectify it.

No comments:

Post a Comment