只有一個 ip 但是有很多個 domain name
可是我的 apache 會將每個 domain name 都對應到 /var/www 底下
這是我的 httpd.conf 裡頭 virtualMachine 的部份:
- 代碼: 選擇全部
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them.
# Please see the documentation at <URL:http://www.apache.org/docs/vhosts/>
# for further details before you try to setup virtual hosts.
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# If you want to use name-based virtual hosts you need to define at
# least one IP address (and port number) for them.
#
#NameVirtualHost 12.34.56.78:80
#NameVirtualHost 12.34.56.78
NameVirtualHost 111.222.333.444
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
#
#<VirtualHost ip.address.of.host.some_domain.com>
# ServerAdmin webmaster@host.some_domain.com
# DocumentRoot /www/docs/host.some_domain.com
# ServerName host.some_domain.com
# ErrorLog logs/host.some_domain.com-error.log
# CustomLog logs/host.some_domain.com-access.log common
#</VirtualHost>
#<VirtualHost _default_:*>
#</VirtualHost>
<VirtualHost *>
ServerName localhost
DocumentRoot /var/www
</VirtualHost>
<VirtualHost *>
ServerName 111.222.333.444
DocumentRoot /var/www
</VirtualHost>
<VirtualHost *>
ServerName dns1.com.tw
DocumentRoot /home/dns1
</VirtualHost>
<VirtualHost *>
ServerName dns2.com.tw
DocumentRoot /home/dns2
</VirtualHost>
<VirtualHost *>
ServerName dns3.com.tw
DocumentRoot /home/dns3
</VirtualHost>