Http Server Virtual Host



If you're looking for a web host that's more reliable than a shared host, but not as pricey as a dedicated host, a virtual private server (VPS) might be what you need. In our testing, these top. The term Virtual Host refers to the practice of running more than one web site (such as company1.example.com and company2.example.com) on a single machine. Virtual hosts can be ' IP-based ', meaning that you have a different IP address for every web site, or ' name-based ', meaning that you have multiple names running on each IP address. Jan 20, 2020 In this article, you will learn about how to set up Apache virtual hosts on an Ubuntu Linux. During this process, you will learn how to serve different sites to different users depending on the domain/site they are requesting. Apache Web Server. The Apache web server is the most popular and powerful way of serving web sites on the internet. Using Virtualhost and modproxy together. The following example allows a front-end machine to proxy a virtual host through to a server running on another machine. In the example, a virtual host of the same name is configured on a machine at 192.168.111.2. Name-based virtual hosts use multiple host names for the same IP address. A technical prerequisite needed for name-based virtual hosts is a web browser with HTTP/1.1 support (commonplace today) to include the target hostname in the request. This allows a server hosting multiple sites behind one IP address to deliver the correct site's content.

  1. Virtual Host Example
  2. Host Virtual Machine

On the Oracle HTTP Server machine, manually configure the ports for internal and external communication. Also, create virtual hosts for internal and external communication.

Configuring SSL Port and Virtual Host for External Communication

To configure the port and virtual host for external communication:

  1. Using a text editor, open EPM_ORACLE_INSTANCE/httpConfig/ohs/config/OHS/ohs_component/ssl.conf.

  2. Ensure that the SSL port for external communication is listed under OHS Listen port. The entry should be similar to the following:

    If you are using 4443 as the port for external communication, your entry should be:

  3. Create a virtual host definition similar to the following:

    Note:

    Include the directive proxypreservehost ON if you are front-ending EPM System with an SSL offloader.

  4. Save and close ssl.conf.

Configuring Port and Virtual Host for Internal Communication

To configure the port and virtual host for internal communication:

  1. Using a text editor, open EPM_ORACLE_INSTANCE/httpConfig/ohs/config/OHS/ohs_component/httpd.conf.

  2. Ensure that the port for internal communication is listed as the value of OHS Listen port. The entry should be similar to the following:

    If you are using 19000 as the port for internal communication, your entry should be:

    Caution!

    EPM System Configurator resets the listen port number to the default value (19000) each time you reconfigure the web server. If you are not using the default port, verify the port number in httpd.conf.

  3. Create a virtual host definition similar to the following:

    Note:

    Include the directive proxypreservehost ON if you are front-ending EPM System with an SSL offloader.

  4. Save and close httpd.conf.

Configuring Oracle HTTP Server Communication with WebLogic Server

To configure communication with WebLogic Server:

  1. Using a text editor, open EPM_ORACLE_INSTANCE/httpConfig/ohs/config/OHS/ohs_component/mod_wl_ohs.conf.

  2. Ensure that the WLProxySSL directive is enabled, for example:

  3. Save and close mod_wl_ohs.conf.

  4. Restart Oracle HTTP Server.

Running several name-based web sites on a single IP address.

Your server has a single IP address, and multiple aliases (CNAMES) point to this machine in DNS. You want to run a web server for www.example.com and www.example.org on this machine.

Note

Virtual Host Example

Creating virtual host configurations on your Apache server does not magically cause DNS entries to be created for those host names. You must have the names in DNS, resolving to your IP address, or nobody else will be able to see your web site. You can put entries in your hosts file for local testing, but that will work only from the machine with those hosts entries.

Server configuration

# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example.com
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example.org
# Other directives here
</VirtualHost>

The asterisks match all addresses, so the main server serves no requests. Due to the fact that www.example.com is first in the configuration file, it has the highest priority and can be seen as the default or primary server. That means that if a request is received that does not match one of the specified ServerName directives, it will be served by this first VirtualHost.

Note

You can, if you wish, replace * with the actual IP address of the system. In that case, the argument to VirtualHostmust match the argument to NameVirtualHost:

NameVirtualHost 172.20.30.40
<VirtualHost 172.20.30.40>
# etc ...

Virtual host example

However, it is additionally useful to use * on systems where the IP address is not predictable - for example if you have a dynamic IP address with your ISP, and you are using some variety of dynamic DNS solution. Since * matches any IP address, this configuration would work without changes whenever your IP address changes.

Http Server Virtual Host

Host Virtual Machine

The above configuration is what you will want to use in almost all name-based virtual hosting situations. The only thing that this configuration will not work for, in fact, is when you are serving different content based on differing IP addresses or ports.