What is Virtual Host in Weblogic , how to create it & what
is the advantage ?

Answer Posted / athar mohammad aarif

Virtual Host is a configured 'Host Name' that routes
requests from a particular 'DNS Name' to a particular
Weblogic Server Instance or a Cluster.
Steps to create a Virtual Host :-
The first file we'll need to edit is the Apache httpd.conf
file. For example, mine is here:
C:\Program Files\Apache Group\Apache\conf\httpd.conf
o to the very bottom of your httpd.conf file in your text
editor. You should see an example of a virtual host there.
Each line of that example will begin with an octothorpe (#).
The octothorpe character marks the line as a comment, so the
example is not executed. Add the following lines below that
example:

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
DocumentRoot "C:\My Sites\Site1"
ServerName site1.local
</VirtualHost>

<VirtualHost 127.0.0.1>
DocumentRoot "C:\My Sites\Site2"
ServerName site2.local
</VirtualHost>

That's all you need to do! Save and close the file. That
will tell the Apache server everything it needs to know in
order for it to serve the pages using the domain names
site1.local and site2.local. One note is that, in the above
example, we have a space in the path. Because of that, we
put quotation marks around the document root directory. If
the path does not have any spaces in it, do not quote the
path. If the directory used for your sites were, for example
MySites instead of My Sites, the document root line would
look like this instead:
DocumentRoot C:\MySites\Site1
Provide the information about the configured Virtual Host in
Apache in the Weblogic Server Console at 'Virtual Hosts -->
Create New' tab.

Resolving the DNS issue

Obviously, if you typed http://site1.local in your browser,
it would not be found by your Internet provider's DNS
server. We're next going to edit another file to work around
that. The second file you need to edit is called hosts, with
no file extension. It is a Windows system file and it will
enable you to enter specific addresses for specific domains
instead of using a DNS lookup. The normal location for this
file is:

C:\WINNT\system32\drivers\etc\hosts

or

C:\Windows\system32\drivers\etc\hosts

If you don't find it there, do a search in your windows
directory for the word hosts in the file name. The file you
want is called hosts, with no file extension. The correct
file will begin with the following lines:

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for
Windows.


Once again, in this file, the octothorpe character is a
comment marker. Lines beginning with it are comments. In all
likelihood, there will be nothing there, except for
comments. If there are any other non-commented entries,
leave them alone. Just go to the bottom of the file, below
all the comments and any existing entries and add the
following two lines:

127.0.0.1 site1.local
127.0.0.1 site2.local

That's all you need to do there. Save and close the hosts file.

You're almost done! The only remaining thing you need to do
is to re-start the Apache server. You need to do this
because Apache only reads the configuration file when it
first starts up. Click Start->Programs->Apache HTTP
Server->Control Apache Server->Restart. If you don't have
that menu item, open a command prompt and change to the
Apache directory, and type the following command and press
the Enter key:

apache -w -n "Apache" -k restart

You should see a message like this:

The Apache service is restarting.
The Apache service has restarted.

That's it! You're done! Close the command window and start
your web browser. In the browser's address bar, type
http://site1.local and hit the Enter key. You should now see
your local copy of your site1.

Okay, now I'll mention one very small, but possibly
important, caveat. When you create the virtual hosts like
this, the default http://localhost will no longer work. In
many cases, that is unimportant. However, if you're using
something like phpMyAdmin, you'll still need it. The
solution to that is to create one additional virtual host
called "localhost" that points to the original Apache htdocs
folder. It might look something like this:

<VirtualHost 127.0.0.1>
DocumentRoot C:\Apache\htdocs
ServerName localhost
</VirtualHost>


Don't forget to include that additional virtual host when
you edit the Windows hosts file.

Note that there are other optional settings you can use to
configure the virtual host. The above uses only two lines
and that's all that's really necessary. You can read about
other options in the Apache documentation. Note that this
link is to the Apache web site and it will open a new
browser window.

I hope you found this more helpful than confusing. Good luck!

Is This Answer Correct ?    6 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the no_acknowledge acknowledge mode used for? : BEA Weblogic

525


What Is The Advantage Of Clustering ?

559


Tell me how is the security handled in web logic j2ee connector architecture?

492


What happens if remove( ) is never invoked on a session bean?

521


How to configure a DB connection pool ?

580






How do I use unicode codesets with the weblogic jdriver for oracle driver? : BEA Weblogic

535


A client invokes a method on a stateful session bean instance deployed in the weblogic server. While the method execution is in progress another method call arrives on the server. What will be the result? : BEA Weblogic

518


What is the list of pre-configured queues?

535


What Are The Various Types Of Weblogic Installations ?

653


Can you briefly describe local interfaces?

535


What are jvm tuning parameters?

572


Explain the difference between dynamic and non-dynamic changes in the console?

534


While packaging the web application defaultwebapp for deployment into the weblogic server, the home and remote interfaces of the enterprise beans used by the servlets should reside in which directory? : BEA Weblogic

528


How can I control on which weblogic server(s) my application will run? : BEA Weblogic

517


What is meant by cluster??

557