1. install apache server, name server bind and caching-nameserver for reference of name server configuration, also install httpd-manual to make sure the related reference can be found when not sure about the configuration of HTTPD

2.configure HTTPD first,
change last several lines into
vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
    DocumentRoot /var/www/web1
    ServerName  web1.ls.com
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot /var/www/web2
    ServerName  web2.ls.com
        <Directory /var/www/web2>
                Options Indexes Includes
                AllowOverride AuthConfig
        </Directory>
</VirtualHost>
 
they are two hosts, and the web2 will use password authentication.
now configure the web pages and make them into the right folder.
 
and configure the authentications:
goes to /etc/httpd/conf/
htpasswd -cm .htpasswd rocky
then type in password
now vim /etc/www/web2/.htaccess
AuthName        "Rocky test web2"
AuthType        Basic
AuthUserFile    /etc/httpd/conf/.htpasswd
Require         valid-user
start the httpd server.
Before install the named server, configure /etc/hosts and add web1.ls.com and web2.ls.com into hostnames to test httpd work properly.
 
Now configure named server
cp /etc/named.caching-nameserver.conf  /etc/named.conf
change named.conf  to allow  anyone to use it
 listen-on port 53 { 127.0.0.1;any; };
        allow-query     { localhost;any; };
and diable views, then create a new zone
zone ls.com{
type master;
file  "ls.com.zone";
};
now edit the zone files
cp /var/named/localhost.zone /var/named/ls.com.zone
vim /var/named/ls.com.zone
                IN NS           @
web1            IN A            192.168.0.5
web2            IN A            192.168.0.5
                     IN A            127.0.0.1
                     IN AAAA         ::1
 
change the /etc/hosts and delete web1/web2 from host name.
now start named and ping web1.ls.com to see if it is working
 
goes to client and vim /etc/resolv.conf
add
nameserver 192.168.0.5
 
now open web2.ls.com to see if its working

 

Advertisements