2010/4/14 13:54:54
一、配置DNS服务器。
1、在/etc/bind/named.conf中添加以下内容
zone "jun.com" { //正向区域
type master; //定义此区为主服务器
file "/etc/bind/db.jun"; // 指定区资源文件的位置
};
zone "0.168.192.in-addr.arpa" { //反向区域
type master;
file "/etc/bind/db.192";
};
2、在/etc/bind中建立db.jun文件,内容如下:
$TTL 604800
$ORIGIN jun.com.
@ IN SOA jun.com. root.jun.com. (
2006080401
604800
86400
2419200
604800
)
IN NS ns
IN MX 0 mail.jun.com.
@ IN A 192.168.0.47
ns IN A 192.168.0.47
www IN A 192.168.0.47
webserver IN CNAME www
mail IN A 192.168.0.47
ftp IN A 192.168.0.48
ns2 IN A 192.168.0.48
ns3 IN A 192.168.0.49
3、重启bind服务
sudo /etc/init.d/bind9 restart
二、设置固定IP,即把IP设置为192.168.0.47
vim /etc/network/interfaces
输入:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.47
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.47
然后重启网络服务:
sudo /etc/init.d/networking restart
三、配置apache2服务
1、 设置httpd.conf。
sudo vim httpd.conf
添加以下内容:
<VirtualHost 192.168.0.47>
ServerName www.jun.com
DocumentRoot /home/jun/www
</VirtualHost>
2、在/home/jun/www下新建文件index.html,内容如下:
<html>
<body>
<a href="www.baidu.com" mce_href="www.baidu.com">www.baidu.com</a>
</body>
<html>
3、重启apache2服务
sudo /etc/init.d/apache2 restart
四、验证
在浏览器中访问
www.jun.com,显示百度的超级链接。