LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 577|回复: 1

httpd -- Virtual Host Problem

[复制链接]
发表于 2003-10-10 04:06:55 | 显示全部楼层 |阅读模式
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.
 楼主| 发表于 2003-10-13 02:12:55 | 显示全部楼层
notice <Directory> or DirectoryIndex, I figure out the problem by set either of them.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表