2008-06-18
lighttpd配置子域名和重定向
关键字: lighttpd subdomain redirect
前提是域名服务商支持泛域名,加这样三条A记录
1,重定向beyondrails.com到www.beyondrails.com
2,二级域名端口转发
3,具体的lighttpd配置
lighttpd的URL Rewrites配置语法:
正则表达式:
替换模式:
beyondrails.com 120.72.34.135 www. beyondrails.com 120.72.34.135 *.beyondrails.com 120.72.34.135
1,重定向beyondrails.com到www.beyondrails.com
$HTTP["host"] =~ "^beyondrails\.com$" {
url.redirect = ( "^/(.*)" => "http://www.beyondrails.com/$1" )
}
2,二级域名端口转发
$HTTP["host"] =~ "^.*\.beyondrails\.com$" {
proxy.balance = "hash"
proxy.server = (
"" => (("host" => "127.0.0.1", "port" => 9999))
)
}
3,具体的lighttpd配置
$HTTP["host"] =~ "^.*\.beyondrails\.com$" {
server.document-root = #...
}
lighttpd的URL Rewrites配置语法:
url.rewrite-once = ( "<regex>" => "<relative-uri>" )
正则表达式:
Patterns ("wildcards") are matched against a string
pecial characters:
* . (full stop) - match any character
* * (asterisk) - match zero or more of the previous symbol
* + (plus) - match one or more of the previous symbol
* ? (question) - match zero or one of the previous symbol
* \? (backslash-something) - match special characters
* ^ (caret) - match the start of a string
* $ (dollar) - match the end of a string
* [set] - match any one of the symbols inside the square braces.
* (pattern) - grouping, remember what the pattern matched as a special variable
* {n,m} - from n to m times matching the previous character (m could be ommited to mean >=n times)
Normal alphanumeric characters are treated as normal
替换模式:
If the matched regex contains groups in parentheses, $1..$9 in the replacement refer to the captured text in the matching group "$1" meaning the first group, "$2" the second, and so on.
You can also use certain meta-patterns in replacement text:
* %% => % sign
* %0 => domain name + tld (Top Level Domain, like .com or .net)
* %1 => tld
* %2 => domain name without tld
* %3 => subdomain 1 name
* %4 => subdomain 2 name
- 00:37
- 浏览 (370)
- 评论 (0)
- 分类: Infrastructure
- 相关推荐
发表评论
- 浏览: 681936 次
- 性别:

- 来自: BJ

- 详细资料
搜索本博客
我的相册
screenshot
共 1 张
共 1 张
最近加入圈子
最新评论
-
Mnesia用户手册:三,构建 ...
要想创建disc_copies和disc_only_copies类型的表有两个前 ...
-- by hideto -
翻译www.djangobook.com之 ...
有个问题问一下: 我先配置了一个urlpatterns是这样的: r'^myd ...
-- by lyhapple -
Why OO sucks
gigix 写道lyl0035 写道为啥就没人想想,其实在面向对象的代码中也流露 ...
-- by hurd -
Why OO sucks
貌似又回到当年java vs c的年代。两种方式,不管是OO还是FP,仅是人处理 ...
-- by python -
大家可以抛弃Java踹死Djan ...
to phoenixup:1,你还别说,你举的什么Struts,Tapestry ...
-- by hideto






评论排行榜