Original of this document is at: xxx


Creating Virutal Domains With APACHE


Virtual Domains, or Virtual Hosts, are full domain names that piggy back on your domain in the WebCube. Each Virtual Host is assigned a unique IP number which is configured on the WebCube to point at the WebCube and not out to another machine like it normally should. When the WebCube accepts the request for the Virutal Host IP number it passes it along to the Apache server. Apache is then configured to take all requests for that Virutal Host and point them to a unique starting directory.

Vitural Hosts are good becuase many Domain Names can be used on one machine. This allows one domain to sell space to others who do not have the means or knowledge to have a machine of their own to place their domain on.

For this documentation we will be creating a virtual domain with the following attributes:

NameIP NUMBER
my.webcube.com123.456.789.10
bigdog.com123.456.789.20


I have broken this document into six sections. The sections must be compleated in the order they are presented.
  1. Id Alias
  2. Removing The Old Virtual Domain Configuartion
  3. Configuring The DNS
  4. Setting Up The Httpd
  5. Setting Up Email
  6. Uploading Your HTML Pages



The script Makezone can be used to automate the following instructions. If you use this program you will not need to do any of the following information below. However, you should be aware of the steps that are required to create a virutal domain.


Step 1 - Id Alias


If you have purchased your WebCube after May 29,1996 or have download pcn_update 0.9.10 then you want to follow the following instructions:

In the directory /etc/sysconfig/virtual-domains you need to create filenames virtual-domain-00 In which you place thefollowing.

IPADDR=123.456.789.20
HOSTNAME=www.pacnet.com

IPADDR should be equal to the IP number of the new domain. Just use a number that you were assinged but have not used yet.

HOSTNAME should be the new name that you registerd with InterNic.

Then you can continue to create the files virtual-domain-xx. Where xx is equal to the number in progression from 01 to 99.

You now should skip down to the next section.


If you have purchased your WebCube before May 29, 1996 then you want to follow these instructions:

We highly reccommend you download pcn_update 0.9.10 now and then follow the easy instructions on how to do Id Aliasing with the patch.

Type "ifconfig" at the bash prompt and will will see something like this:


lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Bcast:127.255.255.255  Mask:255.0.0.0
          UP BROADCAST LOOPBACK RUNNING  MTU:2000  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0
          TX packets:198176 errors:0 dropped:0 overruns:0

eth0      Link encap:10Mbps Ethernet  HWaddr 00:A0:24:56:4D:D0
          inet addr:204.140.249.15  Bcast:204.140.249.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:67622 errors:0 dropped:0 overruns:0
          TX packets:79500 errors:0 dropped:0 overruns:0
          Interrupt:11 Base address:0x6000 

dummy0    Link encap:10Mbps Ethernet  HWaddr 00:00:00:00:00:00
          inet addr:192.0.0.1  Bcast:192.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0
          TX packets:0 errors:0 dropped:0 overruns:0

Write down the "HWaddr" number in the eth0 section. You will need it in the next step.

Edit the /root/multip.scrpt file.
Here is an example of how it might look:

#!/bin/sh
#Set Variables
HDWR_ADDR="00:A0:24:56:4D:D0" # Hardware address of ethernet device
#
IP_ADDR_0="123.456.789.20" # 1st Dummy IP
#IP_ADDR_1="123.456.789.21" #2nd Dummy IP
#IP_ADDR_2="123.456.789.21" #3rd Dummy IP
#IP_ADDR_3="123.456.789.21" #4th Dummy IP
#IP_ADDR_4="123.456.789.21" #5th Dummy IP
#IP_ADDR_5="123.456.789.21" #6th Dummy IP
#IP_ADDR_6="123.456.789.21" #7th Dummy IP
#IP_ADDR_7="123.456.789.21" #8th Dummy IP
#IP_ADDR_8="123.456.789.21" #9th Dummy IP
#IP_ADDR_9="123.456.789.21" #10th Dummy IP
#
#Install modules - as many a you need
/sbin/insmod -o dummy0 /lib/modules/1.2.13/net/dummy.o
/sbin/insmod -o dummy1 /lib/modules/1.2.13/net/dummy.o
#Install modules
#First device
/sbin/ifconfig dummy0 ${IP_ADDR_0} up
/sbin/route add ${IP_ADDR_0} dummy0
/sbin/arp -s ${IP_ADDR_0} ${HDWR_ADDR} pub
#Second device
#/sbin/ifconfig dummy1 ${IP_ADDR_1} up
#/sbin/route add ${IP_ADDR_1} dummy1
#/sbin/arp -s ${IP_ADDR_1} ${HDWR_ADDR} pub
#Third device
#/sbin/ifconfig dummy1 ${IP_ADDR_2} up
#/sbin/route add ${IP_ADDR_2} dummy1
#/sbin/arp -s ${IP_ADDR_2} ${HDWR_ADDR} pub
.
.
.
#tenth device
#/sbin/ifconfig dummy1 ${IP_ADDR_9} up
#/sbin/route add ${IP_ADDR_9} dummy1
#/sbin/arp -s ${IP_ADDR_9} ${HDWR_ADDR} pub
All lines that begin with # are comments and are not read by the computer.

Note how the value of HDWR_ADDR is equal to the HWaddr from above. Change your HDWR_ADDR to equal yoru HWaddr. You will only have to do this step ONCE and never need to do it again.

Now look at the IP_ADDR_0 line above. Notice how it is set to the IP number of bigdog.com? Change IP_ADDR_0 to equal your new virtual domain's IP-number.

When you create a second, third, or fourth virtual domain, Simply add the new domains IP number to the next IP_ADDR line and uncomment it and also uncomment the next device section.


Step 2 - Removing the old Virtual Domain Configuartion


Type 'ifconfig' to see what domains you have running.

If you purchased your system after May 29 or have downloaded the patch 0.9.10 then:

Type 'virtual-domain-down' to remove all domains.
Then type 'virtual-domain-up' to start up the process again.

If you purchased your system before May 29 and have not installed patch 0.9.10 then:

type 'rmmod dummyNUMBER' (where NUMBER is then number of the dummy process.)
type 'multip.scrpt'
Test by pinging the new virtual domain's ipnumber. (ex: 'ping 123.456.789.20')


Step 3 - Configuring the DNS


If you are not too familiar with Domain Name Servers, check out the book DNS_and_BIND by O'Reilly & Associates.

Look inside the /etc/named.boot file and find out where your DNS files are.

;sample /etc/named.boot file. This file is not complete.
;boot file for name server
;
directory /etc

The above example shows that all DNS files are located in the /etc directory. Due to the fact that the /etc directory has many files placed in it by default, I recomend that you create the directory /etc/namedb and place all your DNS files there. This makes it easier for you to keep track of all your virtual domain zone files.

Change your /etc/named.boot file to make your directory /etc/namedb by changing the above line to directory /etc/namedb. You then must copy all the DNS files (named*) and exsisting virtual domain zone files to your /etc/named directory.

cp /etc/named* /etc/namedb

In the file /etc/named.boot we want to add our new domain.

primary         bigdog.com        bigdog.com

Now in the /etc/namedb/ directory we want to create the file bigdog.com. In this example, we are creating the new domain for bigdog.com with an ip address of 123.456.789.20 on the machine my.webcube.com with an ip address of 123.456.789.10. The file below would be named /etc/namedb/bigdog.com
Inside the file you see this..

;
;
@       IN      SOA     bigdog.com.       hostmaster.bigdog.com. (
                                5       ; Serial number
                                172800  ; Refresh every 2 days
                                3600    ; Retry every hour
                                1728000 ; Expire every 20 days
                                172800 ); Minimum 2 days
;
                IN      NS      my.webcube.com.
;
bigdog          IN      A       123.456.789.20
;
www             IN      A       123.456.789.20
ftp             IN      A       123.456.789.20
nntp            IN      A       123.456.789.20
;
bigdog.com.     IN      A       123.456.789.20

Everytime you change this file, you need to change the serial number or it will not be updated by the DNS. Just add 1 to the number.

In the line

		IN	NS	my.webcube.com

"my.webcube.com" should be the host and domain name for your Name Server. I am assuming you are primary DNS for your machine. If you are not, place the name of your Name Server where "my.webcube.com" is above. If you are not sure if you are Primary DNS or not, open an xterm window and type:

whois your.domainname.com

You record should look something similar to this:

[root@pacnet /root]# whois pacnet.com
[rs.internic.net]
Pacific Internet (PACNET-DOM)
   600 Corporate Point, Suite 100
   Culver City, CA 90230
   USA

   Domain Name: PACNET.COM

   Administrative Contact:
      Hipsher, Garry  (GH54)  garry@TRANTECH.COM
      310.215.8040 (FAX) (310) 215-8070
   Technical Contact, Zone Contact:
      Gomberg, Michail  (MG391)  michail@SOFTAWARE.COM
      310-305-0275

   Record last updated on 17-Oct-95.
   Record created on 18-Nov-94.

   Domain servers in listed order:

   GREENLAND.TRANTECH.COM       204.140.249.4
   EUROPE.TRANTECH.COM          204.140.249.11

Note that Domain servers at the bottem. Greenland is our main WebCube and 204.140.249.4 is our IP address. Your host and domain name should be under the Domain servers with the correct IP address to it. If not, then you are not a primary dns server. We reccommend that you update your records with internic. It will take Internic two weeks to process the request. You can do it on-line by editing section 7 of the domain name registration form at http://rs0.internic.net/cgi-bin/reg/domain-update-form.

Next I reccomend that you create a file named IP-NUMBERS in the same direcotry that will contain ALL of the IP-NUMBERS with each of their domain names that are on your system. Place the new domain name and IP number in a list in Numerical Order. This will not be accessed by any program but will help you keep track of your ip numbers as your domains grow. An entry may look like this:

123.456.789.10 		bigdog.com

Now type named.restart to restart the name deamon.


Step 4 - Setting up httpd


The file /etc/srm.conf is the Resource Configuartion File. No changes are neccessary at this time to this file. If you would like to learn more about the srm.conf file then visit http://www.aha.ru/docs/apache/srm.conf.html .

The file httpd.conf needs to have some virtualhosts added to the bottem of it. Here is an example with bigdog.com:

<VirtualHost bigdog.com>
ServerAdmin webmaster@bigdog.com
DocumentRoot /usr/local/html/bigdog.com
ServerName bigdog.com
ErrorLog /var/log/bigdog.com-error_log
TransferLog /var/log/bigdog.com-access_log
</VirtualHost>
The DocumentRoot entry is a directory. "bigdog.com" is the name of the directory in the /usr/local/html directory that you are going to place all of bigdog.com's html files. Make sure you create a directory in /usr/local/html with the name you place here.

Add a new VirtualHost section for each virtual domain on your system. If you would like to learn more about the httpd.conf file, please visit http://www.aha.ru/docs/apache/httpd.conf.html.

Now type 'killall httpd; httpd' to restart the http deamon.


Step 5 - Setting Up Email


You want to add the new virtual domain name to the /etc/sendmail.cw file. This way, any mail addressed to USER@new.virtualdomain.com will actually be sent to USER@your.WebCube.com. In order for them to recieve the mail you will need to create a user account on your WebCube for them.

Here is a sample sendmail.cw file for our fictious machine.

# sendmail.cw - include all aliases for your machine here.
webcube.com
my.webcube.com
bigdog.com
After you have edited your sendmail.cw file and added the line or lines containing the new virtual domain name you need to shutdown and restart the sendmail program by typeing:

/etc/rc.d/init.d/sendmail stop
/etc/rc.d/init.d/sendmail start


Step 6 - Uploading your pages


The home directory to put your home pages is in /usr/local/html/main
This directory is actually a symbolic link when the cube is shipped. The link points to the /usr/local/html/online directory which contains the online documentation for the WebCube. This is why you see the online documentaion when you first bring up netscape.

This is defined in the /etc/srm.conf file as the line DocumentRoot

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.

DocumentRoot /usr/local/html/main/

If you had setup your webpages while using NSCA, and have installed APACHE by using pcn_update, then your webpages have moved from the /usr/local/etc/httpd/htdocs directory to the /usr/local/html/main directory. You are now ready to upload your webpages to /usr/local/html/main. You do not need to do anything further.

If you have just purchased a WebCube then the file /usr/local/html/main is actually a symbolic link to /usr/local/html/online which contains the online documentation for the WebCube. This is why the online documentation pops up when start netscape.

Type: ll /usr/local/html and see if the file is a symbolic link or not.

If the file looks like:

drwxrwxr-x 2 root root 1024 Jun 10 19:24 main/

Then it is a DIRECTORY and you are ready to upload your web pages to /usr/local/html/main. You do not need to do anything further.

If the file looks like:

lrwxrwxrwx 1 root root 22 May 8 01:33 /usr/local/html/main -> /usr/local/html/online/

Then it is a link and needs to be destroyed.
follow the commands below to destroy the link and create a directory.

  1. Type: rm -f /usr/local/html/main
  2. Type: mkdir /usr/local/html/main


You are now ready to upload your web pages to /usr/local/html/main.


Pacific Internet Technical Support
This page was designed by Robert Jordan for Pacific Internet and their WebCube users.