# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /www/deerol_com
ServerName www.deerol.com
# Other directives here
#配置域名的目录访问权限
<Directory "/www/deerol_com">
Options Indexes FollowSymLinks
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/163_com
ServerName www.163.com
# Other directives here
#配置域名的目录访问权限
<Directory "/www/deerol_com">
Options Indexes FollowSymLinks
allow from all
</Directory>
</VirtualHost>
以上代码应该加入到Apache配置文件httpd.conf中的类似代码的后面;
·DocumentRoot表示网站根目录,ServerName表示需要服务的域名,80表示Apache监听80端口
在你正确写入以上代码之后,apache会就用户访问的域名对应配置中的ServerName选择合适的web目录输出html代码。以上设置中第一项(即ServerName www.deerol.com)是默认选项。若用户访问所指定的域名不符合所有条目时采用默认项,即指向
www.deerol.com。