Skip to content

Commit 15f8cd1

Browse files
author
wuyc
committed
服务器名称.md
1 parent 943870a commit 15f8cd1

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

介绍/服务器名称.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# 服务器名称
22

3+
- [通配符名称](#通配符名称)
4+
- [正则表达式名称](#正则表达式名称)
5+
- [其他名称](#其他名称)
6+
- [国际化名称](#国际化名称)
7+
38
服务器名称是使用 [server_name](http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) 指令定义的,它确定了哪一个 [server](http://nginx.org/en/docs/http/ngx_http_core_module.html#server) 块被给定的请求所使用。另请参见 [nginx 如何处理请求](nginx如何处理请求)。可以使用精确的名称、通配符或者正则表达式来定义他们:
49

510
```nginx
@@ -151,8 +156,19 @@ server {
151156
}
152157
```
153158

159+
## 国际化名称
160+
应使用 [server_name](http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) 指令中的ASCII(Punycode)表示来指定国际化域名([IDN](https://en.wikipedia.org/wiki/Internationalized_domain_name)
161+
162+
```nginx
163+
server {
164+
listen 80;
165+
server_name xn--e1afmkfd.xn--80akhbyknj4f; # пример.испытание
166+
...
167+
}
168+
```
169+
154170
## 优化
155-
确切的名称、以星号开头的通配符名称和以星号结尾的通配符名称被存储在绑定到监听端口的三种哈希表中。哈希表的大小可以在配置阶段优化,因此可以在 CPU 缓存未命中的最低情况下找到名称。设置哈希表的具体细节在单独的文档中提供
171+
确切的名称、以星号开头的通配符名称和以星号结尾的通配符名称被存储在绑定到监听端口的三种哈希表中。哈希表的大小可以在配置阶段优化,因此可以在 CPU 缓存未命中的最低情况下找到名称。设置哈希表的具体细节在单独的 [文档](http://nginx.org/en/docs/hash.html) 中提供
156172

157173
首先搜索确切的名称哈希表。如果为找到名称,则会搜索以星号开头的通配符名称的哈希表。如果还是没有找到名称,则搜索以星号结尾的通配符名称哈希。
158174

0 commit comments

Comments
 (0)