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

How do I provide user credentials for starting a server?

506


How do I enable debugging for the messaging bridge? : BEA Weblogic

471


Differences between an application server and a web-server? What is the conman architecture which is used forhigh availability and load balancing describe in few lines.

496


How many messages are sent across the network for processing topic messages? : BEA Weblogic

516


Explain the different versions of nm?

568






I am using a weblogic multitier driver in an applet as an interface to a dbms. If I run the class using the sun appletviewer on my local machine, I have no problems. But when I try to run the applet in a netscape browser, it will not connect 83 the two primary cluster services provided by weblogic server are? : BEA Weblogic

493


How should you type cast a remote object? Why?

547


Do you know what is the function of managedconnection.addconnectioneventlistener() in web logic server?

509


What is web.xml ?

550


How do the wls jms 6.1 server/destination message maximum and threshold values work? : BEA Weblogic

519


How do you differentiate between a server hang and server crash issue?

627


How can the nm be made to work with web logic? Explain?

505


How can domain configuration lock be enabled and disabled?

514


How to write a program to bind string values in a preparedstatement?

629


What is a trace in relation to web logic server?

502