配置幾個簡單的虛擬主機,DNS 服務器IP為169.254.1.189例我公司的域名為:zzvcom.com.我想配置以下幾個服務器為: FTP.zzvcom.com,mail.zzvcom.com,kuanping.zzvcom.com,soft.zzvcom.com, xiaoshou.zzvcom.com,cpzz.zzvcom.com,net.zzvcom.com,yanfa.zzvcom.com. 先安裝RPM域名解析軟件named,再下載apache.tar.gz #tar –zxvf apache.tar.gz #cd apache #./configure –prefix=/usr/local/apache #make;make install;make clean #vi /usr/local/apache/conf/httpd.conf ServerName 169.254.1.189 NameVirtualHost 169.254.1.189 <VirtualHost 169.254.1.189> ServerName ftp.zzvcom.com DocumentRoot /www/ftp TransferLog logs/ftp_Access_log </VirtualHost> <VirtualHost 169.254.1.189> ServerName mail.zzvcom.com DocumentRoot /www/mail TransferLog logs/mail_access_log </VirtualHost> <VirtualHost 169.254.1.189> ServerName kuanping.zzvcom.com DocumentRoot /www/kuanping TransferLog logs/kuanping_access_log </VirtualHost> <VirtualHost 169.254.1.189> ServerName soft.zzvcom.com DocumentRoot /www/soft TransferLog logs/soft_access_log </VirtualHost> <VirtualHost 169.254.1.189> ServerName xiaoshou.zzvcom.com DocumentRoot /www/xiaoshou TransferLog logs/xiaoshou_access_log </VirtualHost> <VirtualHost 169.254.1.189> ServerName cpzz.zzvcom.com DocumentRoot /www/cpzz TransferLog logs/cpzz_access_log </VirtualHost> <VirtualHost 169.254.1.189> ServerName net.zzvcom.com DocumentRoot /www/net TransferLog logs/net_access_log </VirtualHost> <VirtualHost 169.254.1.189> ServerName yanfa.zzvcom.com DocumentRoot /www/yanfa TransferLog logs/yanfa_access_log </VirtualHost> #mkdir /www #cd /www #mkdir ftp mail soft xiaoshou net yanfa cpzz kuanping 分別在/www/ftp /www/mail /www/soft /www/xiaoshou /www/net /www/yanfa /www/kuanping /www/cpzz目錄下放一個各自的主頁(index.Html),並將其屬性設為755. #/usr/local/apache/bin/apachectl configtest #/usr/local/apache/bin/httpd -S 若一切都OK,就可以運行以下命令(啟動apache) #/usr/local/apache/bin/apachectl start #vi /etc/named.conf 在尾部加上如下幾行 zone "1.254.169.in-addr.arpa" in { type master; file "db.1.254.169"; allow-update { none; }; }; zone "zzvcom.com" { type master; file "zzvcom.coms"; allow-update { none; }; }; #vi /var/named/db.1.254.169 @ IN SOA localhost. root.localhost. ( 1997022700 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; EXPire 86400 ) ; Minimum IN NS localhost. 1 IN PTR localhost. 189 IN PTR ftp.zzvcom.com #vi /var/named/zzvcom.coms @ IN SOA dns.zzvcom.com. root.zzvcom.com. ( 947579188 ; Serial Number 10800 ; Refresh after 3 hours 3600 ; Retry after 1 hour 604800 ; Expire after 1 week 86400 ) ; Minimum TTL of 1 day @ IN NS dns.zzvcom.com. localhost IN A 127.0.0.1 ftp IN A 169.254.1.189 mail IN CNAME ftp kuanping IN CNAME ftp xiaoshou IN CNAME ftp net IN CNAME ftp soft IN CNAME ftp yanfa IN CNAME ftp cpzz IN CNAME ftp #vi /etc/resolv.conf domain zzvcom.com nameserver 169.254.1.189 #/etc/rc.d/init.d/named start 用nslookup檢驗一下DNS的正確性 在我們客戶端(WINDOWS下)設置DNS為169.254.1.189(只要這一個,因為我們的DNS服務器還不是一個公網IP,且沒有申請為DNS服務器) 在IE裡打開這個網址 ftp.zzvcom.com soft.zzvcom.com 若正確,所有實驗就成功了。