Virtual Web Hosting
Now that you have everything functional, you shouldn't miss this opportunity to serve virtual web sites.
All you have to do:
- Edit /etc/httpd/conf/httpd.conf
Find Section ### Vitual Hosts ###
- Find this line:
Include conf/vhosts/Vhosts.conf
Make sure it is uncommented. Move to /vhosts directory and tweak Vhosts.conf it will contain all virtual hosting domains.
- Edit Vhosts.conf and insert the following information at the bottom of the script:
<VirtualHost 168.34.26.59>
ServerName onetraining.net
ServerPath /onetraining
DocumentRoot /var/www/html/onetraining/
</VirtualHost>
Note. Do this for each additional virtual Domain.
Move to /var/www/html and create the directory onetraining, move some content into it. Follow this convention (use domain names) to create directories for each domain, it makes it much easier to maintain.
Word of Caution
Please note that during the project in this book, I used a Public IP address for demonstration purposes. Make sure you use your own IP addresses for your servers if you are going live online. For practice, I suggest you use a private local IP address. Refer to chapter 9 for types of networks.
You should setup the web server and the DNS server as different identities. So if the DNS sever goes down; the web server can be still reached through a different DNS (slave for example).
Slave DNS Servers
Once your DNS server resolves your zones correctly, you preferably should set up a slave DNS server for security purposes just in case your primary DNS server goes down. You should have this slave DNS as far as possible from your primary server, especially if you are offering services to the public.
A slave DNS is simply a name server that copies zones files from a master. And it is set up as follows:
Zone “netcontrol.org” {
Type slave;
File “/var/named/nsetcontrol.org.hosts”;
Masters {168.34.26.58};
};
The zones are transferred by the SOA (Start of authority record), using the mechanism called zone-transfer, as follows.
$ttl 38400
netcontrol.org. IN SOA server2.netcontrol.org. root.localhost. (
1063884851 ;Serial
10800 ;Refresh
3600 ;Retry
604800 ;Expire
38400 ) ;Minimum
The zone transfer depends on the serial number. The serial number, in many cases will represent the year + date + hour. The slave will also check on the refresh interval to verify if the master has been updated, if the master has been updated the new information is transferred to the slave DNS to keep the database synchronized.
The verification will depend on the retry time in 3600 seconds (1hr) set as value on the retry option at the SOA of the zone (master server). If the slave DNS fails to contact the master server when it reaches the expired time 604800 seconds and it did not find the master server on each retry; the slave DNS server then removes the zone in its database and will no longer be a slave for that specific zone from the SOA.
|