Virtual hosting, which defines a set of host names to which WebLogic Server instances (servers) or clusters respond. When you use virtual hosting, you use DNS to specify one or more host names that map to the IP address of a server or cluster.
When you deploy the application on virtual host, it means you hide the IP address of the servers which are actually going to serve the requests.
It can either be targeted to one individual server or the whole cluster.
In my example, I have configured a virtual host for the admin server. Below are the steps we need to follow:
1) The first requirement for creating a virtual host is to create a network channel on the admin server.
– Go to the admin console, click on servers -> admin server
– Go to the Protocols -> Channel tab
– Give the name of the channel as port-80, choose the protocol as http.
– Give listen address as localhost, give the listen port as 80. Leave the external listen address and port bank.
– Enable HTTP tunneling as per your preference.
– Leave the security part as it is to the default unchecked values.
– You will see the below configuration once the channel is created.
– Restart the server to confirm that the server is using the default channel and port-80 channel.
2) Once the network channel is created, go to Environment -> Virtual hosts
– Click on new, give a name to the host vh.localhost.org.
– Now click on the virtual host vh.localhost.org, give the below values:
Virtual Host Names: vh.localhost.org
Network Access Point Name: port-80
– Click on targets tab, check the admin server.
– Save the changes and restart the server.
3) Now we need to modify the windows host file in C:WINDOWSsystem32driversetc directory and add the host name vh.localhost.org which we have specified for the virtual host. Add the below in the file:
4) Now deploy one test application following the below steps:
– Click on deployments
– Click on install -> Choose the application from the path
– Click next, check Install this deployment as an application -> target it to the virtual host (not the server)
– Click finish
Deployment state should be active.
Now access the application using the url:
You should see the welcome page of the application.
really very helpful document…thanks a ton.
I am glad you found the doc helpful.. 🙂
I just wanted to say that you deserve two thumbs up for your hard work.
Thanks for the comment.. That was really nice 🙂
Is there a way to deploy applications and target them to virtual hosts using WLST ?
I have tried to do even the recording option but it was useful.
Thanks in Advance.
Yes targeting the application to virtual host using WLST can be done as below:
– Once you are connected to the server, enter the online command:
deploy(appName=’web-app’, path=’C:\web-app’, targets=’vh.localhost.org’)
vh.localhost.ors is the virtual host. It will look like below:
wls:/Channel_vh_domain/serverConfig> deploy(appName=’web-app’, path=’C:\web-app’, targets=’vh.localhost.org’)
Deploying application from C:\web-app to targets vh.localhost.org (upload=false) …
.Completed the deployment of Application with status completed
Current Status of your Deployment:
Deployment command type: deploy
Deployment State : completed
Deployment Message : no message
Let me know if this works for you.
Thanks very much,it realy good document…..
Thanks a lot Subbu 🙂
Thanks a lot .This is a really good document, i enjoyed a lot
Thanks Madhukar 🙂
in url is it manadatory to specify the port number in virtualhost ?
i have tried one example , if i am not giving the port application is not working .in above exaple you haven’t given the port. is any specific rule for giving thevirtualhost name ( means how many character and dots ican give ex:- vh.madhu.test.org can i use this ?
In the above example, the port number i have given is 80. And this port number does not need to be entered in the url. If you give any other port number, for e.g. if i have port number as 7001, the url has to be something like http://vh.localhost.org:7001/web-app.
For giving the virtual host name, there is no rule i know of. It can be a single word or there can be dots too. Let me know if these things work for you.
Thanks for your document. I tried but not showing target server for vh.localhost.org. I am using weblogic 9. Please tell me how i can connect virtual host
Thank you divya. If we are using other than port 80 we have to mention in th URL .. please correct me if i am wrong .
In windows vista aprache proxy plugin is not working .
Please suggest me is vista is not compatablie for proxying the requests WEBLOGIC AND APACHE.
i am using the weblogic 9.2 and apache 2.2.x . Same was working fine in Windows XP
Thanks so much for this post – I found such gobbledygook on the Oracle support discussions that I was beginning to despair. This is a lifesaver!
Thanks for this post – was really helpful and highly appreciated.
I have question. If it will work without defining anything in Apache httpd.conf file.I think the virtual host entries must be reflect in this file also.
please make me correct if I am wrong
i have tried with virtualhost but i am getting some server side exception :
503 Service Unavailable
Failed to resolve the name of server vh.localhost.org to connect
i have included the virtualhost in hosts file also
logs are showing
[HttpServer (VirtualHost) name: vh.localhost.org hosts: [vh.localhost.org] channel: port-80] Initialized>
can any one please help me on this
Thanks in Advance
Can you give me a breif outline of the steps you have followed? I doubt this can be something to do with the network channel.
Thanks for the explanation. couple of questions.
1) in step 4 , isnt the application required to be targeted to the admin server ?
2) can you give some examples where the weblogic virtual hosting is used. I am little confused as to why to use weblogic virtual hosting when the same thing can be done using Apache or Iplanet in a much more efficient way.
It would be targetted to the virtual host because that is the purpose of creating it. This virtual host is made for the admin server (check the step 1). If it is targeted to the admin server, virtual host cannot be used.
About the second question, it depends on you what you prefer. Even in weblogic you can create many virtual hosts and target it to different set of servers or a cluster. It gives you a lot of flexibility.
I have created http-channel with port “80”
i have used same channel in virtual-host configuration after that i
have modified hosts file
i have deployed sample WAR file with weblogic-deployeer utility
i have tried with http://vh.localhost.org/sample
i got error like
Failed to resolve the name of server vh.localhost.org to connect
Did you target that application to the virtual host? Also please tell me what exact error you are seeing after the line failed to connect? I hope you restarted the server after creating the virtual host.
how resolve in managed server starting time show admin mode.
you need to check the server logs..
very good document:) thanks much for updating this 🙂
Thank you for sharing your info. I really appreciate
your efforts and I am waiting for your next write ups thanks once again.
hello all, i have a manged server running on http://localhots:8888/test
I do not want to use port number i.e 8888
Is it possible to run the managed server on http://localhost/test
yes.. change the port number to 80 🙂
And make sure no other server is running on port 80..
Comments are closed.