|
I have only one computer, whose operating system is redhat 9.0. I wanted to try DNS Server and Httpd. But I meet a weird problem when I set virtual host on httpd. The following is the content that I knew:
I set my compute host name "dream", the IP address "130.130.130.1" and domain name is "mynet.com". and also I configured my DNS server. The following is what my DNS file (The mynet.com.zone file)
$TTL 86400
@ IN SOA dream. root.localhost (
23 ; serial
28800 ; refresh
7200 ; retry
604800 ; expire
86400 ; ttl
)
IN NS 130.130.130.1.
IN NS dream.
ccc IN A 130.130.130.2
dream IN A 130.130.130.1
test IN CNAME dream
www IN CNAME dream
vhost IN CNAME dream
I used "dig test.mynet.com"
; <<>> DiG 9.2.1 <<>> test.mynet.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63284
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 0
;; QUESTION SECTION:
;test.mynet.com. IN A
;; ANSWER SECTION:
test.mynet.com. 86400 IN CNAME dream.mynet.com.
dream.mynet.com. 86400 IN A 130.130.130.1
;; AUTHORITY SECTION:
mynet.com. 86400 IN NS dream.
mynet.com. 86400 IN NS 130.130.130.1.
;; Query time: 24 msec
;; SERVER: 130.130.130.1#53(130.130.130.1)
;; WHEN: Sat Oct 4 14:34:11 2003
;; MSG SIZE rcvd: 114
So I assumed that my DNS works fine.
First I tried "http://localhost", I got "Test Page", which means my Apache Server works fine. Then, I tried "http://dream", it also gave my "Test Page", which is also reasonable, since it is my host default name. So I configured the httpd, I created a name virtual host -- vhost, the following is some contents of httpd.conf file.
#
# Use name-based virtual hosting.
#
NameVirtualHost 130.130.130.1
# Where do we put the lock and pif files?
LockFile "-"
CoreDumpDirectory "/etc/httpd"
# Defaults for virtual hosts
# Logs
#
# Virtual hosts
#
# Virtual host Default Virtual Host
<VirtualHost *>
ServerSignature email
DirectoryIndex index.php index.html index.htm index.shtml
<IfDefine HAVE_SSL>
</IfDefine>
LogLevel debug
HostNameLookups off
</VirtualHost>
# Virtual host test
<VirtualHost 130.130.130.1>
DocumentRoot /var/vvv/
ServerAdmin wben@localhost
ServerName vhost.mynet.com
ServerSignature email
HostNameLookups off
</VirtualHost>
I used "httpd -t -D DUMP_VHOSTS" to test, I got:
VirtualHost configuration:
130.130.130.1:* is a NameVirtualHost
default server vhost.mynet.com (/etc/httpd/conf/httpd.conf:1125)
port * namevhost vhost.mynet.com (/etc/httpd/conf/httpd.conf:1125)
wildcard NameVirtualHosts and _default_ servers:
_default_:443 new.host.name (/etc/httpd/conf.d/ssl.conf:90)
*:* dream (/etc/httpd/conf/httpd.conf:1089)
Syntax OK
I restart the httpd, and type "http://vhost.mynet.com". I supposed that I will visit the "index.html" which I saved in /var/vvv/. But I can't, what I got is the "Test Page". I don't know what is the reason. Thank you help me figure it out. |
|