Web Search


Site Search


Youngevity Essential Life Sciences

Independent Representative


Ultimate Health and Wellness starts with the 90 Essential Nutrients

Are You Getting Yours?


Herbal Rainforest

This supplement unleashes the power of herbs and minerals. Easy to take, liquid concentrate of full strength, 100% plant derived minerals with a mango taste.

$41.45*


SlenderFX Sweet EZE

Numerous studies have proven that the trace minerals chromium and vanadium have dynamic and positive effects on supporting healthy blood sugar levels.

$27.10*


Osteo FX

Formulated to support healthy bones and joints. It is a highly absorbable product that contains the co-factors necessary to help your body better absorb the calcium.

$55.70*


HGH Youth

H.G.H Youth Complex has a proprietary blend of amino acids, minerals and sea kelp, which make a truly unique product that cannot be found anywhere else on the market!

$44.30*


*prices in USD & subject to change
Join the Youngevity Team

Deploying Suse Linux Enterprise Server


Purchase "Deploying Suse Linux Enterprise Server"
at Lulu.com

Apache Web Server

Creating Virtual Hosts

To alleviate the need to have a web server for every site that you host, the Apache developers implemented a way for a single web server to host multiple web sites through what are called "Virtual Hosts". Virtual Hosts work by figuring out how a user came to the site and providing the correct web site for that session.

There are basically 2 ways that you can deploy Virtual Hosts. The first is simply by having each host use a different I.P. Address. In this instance you can have a web server with 2 I.P. addresses with site located at 10.0.0.1 and another web site at 10.0.0.2. When a user accesses each address, Apache looks at which address the user is accessing the site through and serves the correct page for that address.

The second, more commonly used way to use Virtual Hosts is to have Apache differentiate the web sites by the actual domain name that is used to access the site. For instance, you can configure apache to serve the addresses www.somewhere.com, mail.somewhere.com and www.somewhere-else.com from the same server. When a user goes to these addresses, Apache will look at the HTTP traffic and figure out which site the user wishes to visit and provide the correct page for that user.

With Suse Linux Enterprise Server HTTP Server Yast Module, it seems apparent that creating Virtual Hosts is somewhat straightforward and simple. Unfortunately this is not the case.

There are a few problems with Yast's implementation of virtual hosts. First, you cannot create a virtual host based on a secondary I.P. Address of a network card. This makes implementing I.P. Virtual Hosts nearly impossible as you would require a physical network card for every virtual host you create.

The second problem comes in when you try to create domain name virtual hosts. The Yast module tries to create a new name virtual host for every hostname you want to create a virtual host for. This is not feasible as I will explain later. For now, let me step you through creating a named base virtual host.


Creating a New Virtual HostAdjusting Settings for the Virtual Host
Creating a New Virtual Host and Adjusting it's Settings

The first step to create a virtual host is to go to the "Hosts" tab within the Yast HTTP Server module and click "Add". This will bring up a wizard that will allow you to fine tune the virtual host.

The wizard begins with the "New Host Information" screen where you specify the server name, the contents root, the administrator email account and the server resolution.

Server Name - Here you enter the fully qualified DNS address that you will use for the virtual host. This is the exact name that must be entered into a web browser to get to this host.

Server Contents Root - Here is where you specify which directory the virtual hosts files are stored in. This is normally "/srv/www/vhostname", but can be located anywhere on the server.

Administrator E-Mail - This is the email address that is shown in any of the error pages that is served to the user.

Server Resolution - This is where Yast kind of messes up the virtual host configuration. For now, just realize that within Yast, you must change the VirtualHost ID for every virtual host you configure. If in doubt, change the ID to *:80, where 80 can be changed to any random number as I will show you how to fix this later.

The next step in the wizard is the "Virtual Host Details" page. Here you specify advanced options that you may or may not want to enable such as CGI and SSL support for the virtual host. You can also specify which file to be used as the directory index file (normally index.html) and whether or not you wish to enable users to access their "public_html" folder through "http://hostname/~username/".

If you have already setup the DNS server on your system you will also have the ability to quickly create a new zone for your DNS server through this page.

Once you are done with the "Virtual Host Wizard", you are brought back to the Hosts tab of the Yast HTTP Server module. This tab should now list the virtual hosts that you have created. Through this tab you can easily adjust any virtual host you have created by highlighting the host and clicking on "Edit". This gives you the ability to fine tune the virtual host similar to how you can fine tune the main host.


Note: Within the Host tab there is a button to "Set as Default" the host that is highlighted. Be warned that this will override any configuration settings that are in the "Main Host" tab and this is probably not what you want. This can actually affect all of your virtual hosts and is very difficult to reverse. I highly recommend that you do not use this button - ever.



Listing All of the Virtual HostsEditing a Virtual Host Configuration
Listing all of the Virtual Hosts and Editing a Virtual Host Configuration

Once you are done creating the virtual hosts and exit out of the Yast HTTP Server module", you will probably find that only 1 virtual host comes up for all of your configured virtual hosts.


Tip: To easily test virtual hosts on the server you simply need to add an entry into the "/etc/hosts" file on the workstation you are working on that points the virtual hostnames to the server's IP Address. Of course this is only a temporary solution, as you will want to add entries into the DNS Server accordingly once everything is configured properly.


For instance if you created virtual hosts named site1, site2 and site3, what is probably the case is that site1 or site2 comes up when you enter any of the above sites. This happens because of the way the Yast HTTP Server module handles assigning virtual host IDs. This is a known bug and have been in contact with the developers about this. Thankfully there is an easy fix.

To fix this, a simple understanding of implementing Apache Virtual Hosts is needed. The first thing to understand is that all of the virtual hosts you have just created are listed within the "/etc/apache2/vhosts.d/yast2_vhosts.conf" file. Yast, as of this writing, does not create this file properly. A properly formatted file with 2 virtual hosts is shown below.

<VirtualHost *:80>
 DocumentRoot /srv/www/testing/
 ServerName testing.private.lan
 ServerAdmin webadmin@private.lan
 <Directory /srv/www/testing/>
  AllowOverride None
  Order allow,deny
  Allow from all
 </Directory>
</VirtualHost>
<VirtualHost *:80>
 DocumentRoot /srv/www/test2/
 ServerName test2.private.lan
 ServerAdmin webadmin@private.lan
 <Directory /srv/www/test2/>
  AllowOverride None
  Order allow,deny
  Allow from all
 </Directory>
</VirtualHost>
	

As you may have gathered already, a normal virtual host setup within Apache utilizes the same <VirtualHost *> directive. The * specifies an IP address to listen to requests from and is usually just * or *:80 (since Apache normally listens to port 80). Unfortunately Yast tries to force the Administrator to create a new virtual host ID for every virtual host, thus rendering the virtual hosts useless.

Once you straighten out the "/etc/apache2/vhosts.d/yast2_vhosts.conf" file you must then create a directive within the "Main Host" configuration that will tell Apache to look for these "Virtual Hosts" that you have created. That directive is:

	NameVirtualHost *:80


Adjusting the Main Host to fix Virtual Hosts
Adjusting the Main Host to fix Virtual Hosts

Once these steps are done, your virtual hosts should be working properly. One final note, if you are setting up different virtual hosts for entirely different domain names, a very important directive is the ServerAlias directive. For instance:

	ServerAlias www.private.lan *.private.lan

Also note that the first virtual host listed in the "/etc/apache2/vhost.d/yast2_vhosts.conf" file is going to be the site that is served by default if no other virtual hosts match the incoming HTTP headers. For instance, when you access the server by IP Address.

Next


Purchase "Deploying Suse Linux Enterprise Server"
at Lulu.com