several frequently used directives for apache server

1.<vituralhost><vituralhost/>, this directive encloses/contains a group of directives and only apply to a paticular vitural host.
Syntax: <VirtualHost addr[:port] [addr[:port]] ...> ... </VirtualHost>
Available values for addr can be:
(1)IP address for virtual host
(2)full quailfied domain name for IP address(deprecated)
(3)*,used only in combination with NameVirtualHost * to match all IP address
(4)_default_,catch unmatched address
Annotation: what is virtual host? Virtual host is a term, 
it is used to describe the practice of
running more than one web site on a single machine.
Virtual can be based on ip which means each web site has its own address,
or domain name which means there have multiple names for each ip.
A typical example for name-based virtual host in HTTP server can be configured like this:
current IP has already been used to match www.yourdomain.itb,
but still can be used to match another virture machine:www.otherdomain.itb.
NameVirtualHost *:80  ----NameVirtualHost用来指定那个IP地址来接受请求,这里使用*匹配服务器上所有的地址
<VirtualHost *:80>
ServerName www.yourdomain.itb
ServerAlias yourdomain.itb *.yourdomain.itb
DocumentRoot /www/domain
</VirtualHost>
<VirtualHost *:80>
ServerName www.otherdomain.itb
DocumentRoot /www/otherdomain
</VirtualHost>
注意:如果向一个已经存在的web server添加虚拟机,需要一个为已经存在的创建<virtualhost>脚本,
这个虚拟机中所包含的ServerName和DocumentRoot要和全局的ServerName和DocumentRoot保持一致。
同时,把它放在配置文件中虚拟机列表的最前面,这样它就是缺省的虚拟机.
--待续
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值