当前位置:web 服务器 > Apache >>

APACHE邦定多域名不用重新启动的原理和方法

答案:

编辑httpd.conf
在最后加上

[quote]
NameVirtualHost *

<VirtualHost *>
rewriteengine on
rewritecond %{HTTP_HOST} [^.]+\.alibaba\.uni\.cc$
rewriterule ^(.+) %{HTTP_HOST}$1 [C]
rewriterule ([^.]+)\.alibaba\.uni\.cc(.*) /$1$2
    ServerAdmin webmaster@XXX.COM
    DocumentRoot /www
    ServerName zhaoxi.net
    ErrorLog logs/zhaoxi.net-error_log
    CustomLog logs/zhaoxi.net-access_log common
</VirtualHost>

http://you.zhaoxi.net对于username的主页请求转换为对http://alibaba.uni.cc/username的请求
---- 对于HTTP/1.1的请求包括一个Host: HTTP头,我们能用下面的规则集重写 http://username.alibaba.uni.cc/anypath到/home/username/anypath。
注: “rewritecond”表明是条件重写规则,当满足后面定义的条件后才会应用下面的重写规则,“rewritecond”有各种变量,请查阅相关文档。

其实是用到了APACHE的重写规则,大家可以看
http://alibaba.uni.cc
我现在还开着的!

上一个:Linux中实现局域网远程接入
下一个:大中型规模灵活定制的网吧组网方案

Apache
IIS
Nginx
Tomcat
如果你遇到web 服务器难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,