我正在尝试在Apache中使用子域名,但它对我不起作用。我已经试过了Virtualhost For Wildcard Subdomain and Static Subdomain。 我现在的代码:
<VirtualHost *:80>
DocumentRoot /Bestanden/webserver/vandervoorden.com/other
ServerName other.vandervoorden.com
ServerAlias *.vandervoorden.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /Bestanden/webserver/vandervoorden.com
<Directory "/Bestanden/webserver/vandervoorden.com">
allow from all
Options +Indexes
</Directory>
ServerName vandervoorden.com
</VirtualHost>
第二个VHost将在vandervoorden.com和www.vandervoorden.com上做出反应,但当我浏览didntexist.vandervoorden.com时,我收到了一个找不到的页面。
答案 0 :(得分:0)
您需要配置dns以返回ip for didntexist.vandervoorden.com
$ dig didntexist.vandervoorden.com A
; <<>> DiG 9.8.3-P1 <<>> didntexist.vandervoorden.com A
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 61164
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;didntexist.vandervoorden.com. IN A
;; AUTHORITY SECTION:
vandervoorden.com. 14400 IN SOA nszero1.axc.nl. hostmaster.vandervoorden.com. 2013071200 14400 3600 1209600 86400
;; Query time: 169 msec
;; SERVER: 129.13.64.5#53(129.13.64.5)
;; WHEN: Mon Jul 15 12:07:03 2013
;; MSG SIZE rcvd: 107