Pages - Menu

Weblogic Virtual Host : Working with Virtual Hosts

Friday, July 26, 2013

Weblogic Virtual Host : Working with Virtual Hosts


Virtual hosting allows you to define host names that servers or clusters respond to. 

When you use virtual hosting you use DNS to specify one or more host names that map to the IP address of a WebLogic Server instance or cluster, and you specify which Web Applications are served by the virtual host. 

When used in a cluster, load balancing allows the most efficient use of your hardware, even if one of the DNS host names processes more requests than the others.

For example :-  

you can specify that a Web Application called books responds to requests for the virtual host name www.books.com, and that these requests are targeted to WebLogic Servers A,B and C, while a Web Application called cars responds to the virtual host namewww.autos.com and these requests are targeted to WebLogic Servers D and E. 


To Create & Test a Virtual Host 


1. 
Edit your hosts file and map your domain / DNS name to the server ip address. 
Unix - /etc/hosts
Window - C:\WINDOWS\system32\drivers\etc\hosts


In Window entry should be like below -


127.0.0.1       localhost mukeshnegi.com



2.
Create a virtual host, Click on Virtual Hosts, New, Enter name for virtual host.

3.
Click on name of virtual host and in "Virtual Hosts Names" field enter your domain name like here, mukeshnegi.com, if you more then one domain name mapped enter each separated by comma


4.
Click on target tab and select managed or admin server wherever you want to target, 

5. Deploy your application on virtual host ( select deployment to deploy and target should be virtual host )

6.
Create a channel
Click on managed or admin server on which you you targeted to virtual host, select channels under protocols on right hand side
Click on new
Enter channel name & select protocol http, select next

Enter port 80, select next

Select default options and click next
Select default option and click next
Click on finish

Now, you can see below lines in the server log file on which you targeted the virtual host -

<Oct 18, 2010 10:52:18 PM IST> <Notice> <Server> <BEA-002613> <Channel "Channel-
0" is now listening on 127.0.0.1:80 for protocols http.>

7.
Now instead of http://<server>:<port>/your_apps_url, access it like http://mukeshnegi.com/your_apps_url

For example - 

if you access your apps like http://localhost:7002/shoppingcart/welcome.jsp then access it like    http://mukeshnegi/shoppingcart/welcome.jsp

3 comments

  1. Thanks for the amazing Post Avvaru

    Is it possible to access my app directly without specifying the app name
    i.e. http://mukeshnegi/ instead of http://mukeshnegi/shoppingcart

    Consider that i will be only having one app deployed in the server.
    Thanks in Advance

    ReplyDelete
    Replies
    1. sir, how did you like that . that time..
      "http://mukeshnegi/ instead of http://mukeshnegi/shoppingcart"

      please help me..

      Delete
  2. I think this can achieve without a virtual host as well, just a channel and hosts file change.??

    ReplyDelete

 

Archives

Blogger news

Blogroll

Most Reading