Skip to content

Commit 7779e13

Browse files
authored
Merge pull request #35 from getchenge/patch-1
修正错误错误翻译
2 parents f6135c4 + 8dfa939 commit 7779e13

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

介绍/Nginx如何处理请求.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ nginx 首先忽略排序搜索具有最明确字符串的前缀 `location`。在
161161
- 请求 `/logo.gif` 首先与 前缀 `location``/` 相匹配,然后由正则表达式 `\.(gif|jpg|png)$` 匹配,因此由后一个 `location` 处理。使用指令 `root /data/www` 将请求映射到 `/data/www/logo.gif` 文件,并将文件发送给客户端。
162162
- 一个 `/index.php` 的请求也是首先与前缀 `location``/` 相匹配,然后是正则表达式 `\.(php)$`。因此,它由后一个 `location` 处理,请求将被传递给在 `localhost:9000` 上监听的 FastCGI 服务器。[fastcgi_param](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_param) 指令将 FastCGI 参数 `SCRPT_FILENAME` 设置为 `/data/www/index.php`,FastCGI 服务器执行该文件。变量 `$document_root`[root](http://nginx.org/en/docs/http/ngx_http_core_module.html#root) 指令的值是一样的,变量 `$fastcgi_script_name` 的值为请求URI,即 `/index.php`
163163
- `/about.html` 请求仅与前缀 `location``/` 相匹配,因此由此 `location` 处理。使用指令 `root /data/www` 将请求映射到 `/data/www/about.html` 文件,并将文件发送给客户端。
164-
- 处理请求 `/` 更复杂。它与前缀 `location``/` 相匹配。因此由该 `location` 处理。然后,[index](http://nginx.org/en/docs/http/ngx_http_index_module.html#index) 指令根据其参数和 `root /data/www` 指令检验索引文件是否存在。如果文件 `/data/www/index.html` 不存在,并且文件 `/data/www/index.php` 存在,则该指令执行内部重定向到 `/index.php`如果请求是由客户端发起的,nginx 将再次搜索 `location`。如之前所述,重定向请求最终由 FastCGI 服务器处理。
164+
- 处理请求 `/` 更复杂。它与前缀 `location``/` 相匹配。因此由该 `location` 处理。然后,[index](http://nginx.org/en/docs/http/ngx_http_index_module.html#index) 指令根据其参数和 `root /data/www` 指令检验索引文件是否存在。如果文件 `/data/www/index.html` 不存在,并且文件 `/data/www/index.php` 存在,则该指令执行内部重定向到 `/index.php`就像请求是由客户端发起的,nginx 将再次搜索 `location`。如之前所述,重定向请求最终由 FastCGI 服务器处理。
165165

166166
由 Igor Sysoev 撰写
167167
由 Brian Mercer 编辑

0 commit comments

Comments
 (0)