基于域名的虛擬主機(jī)步驟)
構(gòu)建基于域名的虛擬主機(jī)步驟:1、 修改dns 配置文件1)去掉 include "/etc/named.rfc1912.zones"的#號(hào)Vim named.rfc1912.zones####添加以
構(gòu)建基于域名的虛擬主機(jī)
步驟:
1、 修改dns 配置文件
1)去掉 include "/etc/named.rfc1912.zones"的#號(hào)
Vim named.rfc1912.zones
####添加以下幾行:
zone "benet.com" IN {
type master;
file "benet.com";
# allow-transfer {10.0.0.3;};
};
zone "0.0.10.in-addr.arpa" IN {
type master;
file "benet.re";
};
zone "accp.com" IN {
type master;
file "accp.com";
};
2)copy /usr/share/doc/bind-9.3.6/sample/var/named/* /var/named/chroot/var/named
3) 創(chuàng)建區(qū)域配置文件
Cd / var/named/chroot/var/named
Vim benet.com
$TTL 86400
@ IN SOA benet.com. root.benet.com. (
1997022701 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS server.benet.com.
IN NS client.benet.com.
IN MX 10 server.benet.com.
IN A 10.0.0.2
server IN A 10.0.0.2
client IN A 10.0.0.3
www IN CNAME server
* IN A 10.0.0.2
moive IN A 10.0.0.4
moive IN A 10.0.0.5
moive IN A 10.0.0.6
moive IN A 10.0.0.7
~
Vim benet.re(反向區(qū)域文件)
,$TTL 86400
@ IN SOA benet.com. root.benet.com. ( 1997022701 ; Serial
28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum
IN NS server.benet.com.
2 IN PTR server.benet.com.
3 IN PTR client.benet.com.
~~
Cp benet.com accp.com
Vim accp.com
$TTL 86400
@ IN SOA accp.com. root.accp.com. ( 1997022700 ; Serial
28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum
IN NS server.accp.com.
IN NS client.accp.com.
IN MX 10 server.accp.com.
IN A 10.0.0.2
server IN A 10.0.0.2
client IN A 10.0.0.3
www IN CNAME server
* IN A 10.0.0.2
moive IN A 10.0.0.4
moive IN A 10.0.0.5
moive IN A 10.0.0.6
moive IN A 10.0.0.7
4) 更改區(qū)域配置文件的屬組和屬主
Chownnamed:namedbenet* accp*
5) 重啟dns
Service named restart
6) 安裝apache
a)tarzxvf httpd-2.2.9.tar.gz –C /usr/src
b)cd /usr/src
#./configure –prefix=/usr/local/apache2 –enable-so –enable-rewrite ##make&& make install
7) 修改httpd.conf 配置文件
去掉Include conf/extra/httpd-vhosts.conf前面的#號(hào)
,修改vim extra/httpd-vhosts.conf
NameVirtualHost 10.0.0.2:80
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/usr/local/apache2/htdocs/benetcom"
ServerName www.benet.com
# ServerAlias www.dummy-host.example.com
#ErrorLog "logs/dummy-host.example.com-error_log"
#CustomLog "logs/dummy-host.example.com-access_log" common
# ServerAdmin webmaster@dummy-host2.example.com DocumentRoot "/usr/local/apache2/htdocs/accpcom"
ServerName www.accp.com
# ErrorLog "logs/dummy-host2.example.com-error_log"
# CustomLog "logs/dummy-host2.example.com-access_log" common
8) 創(chuàng)建網(wǎng)站測(cè)試文件
Mkdir /usr/local/apache2/htdocs/benetcom
Vim /usr/local/apache2/htdocs/benetcom/index.html
Mkdir /usr/local/apache2/htdocs/accpcom
Vim /usr/local/apache2/htdocs/accpcom/index.html www.accp.com
9) 測(cè)試
Elinks
Elinks
10)/usr/ocal/apache2/bin/apachectl restart