8000 Nginx指令执行命令(01) · Tinywan/lua-nginx-redis@704b9cb · GitHub
[go: up one dir, main page]

Skip to content

Commit 704b9cb

Browse files
committed
Nginx指令执行命令(01)
1 parent 3cca122 commit 704b9cb

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

Nginx-Develop/command-order-01.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Nginx指令执行命令(01)
2+
+ `rewrite` 发生在`content`每个请求处理的相位之前,它的命令也被执行得更早
3+
4+
+ 案例
5+
```
6+
server {
7+
listen 8008;
8+
server_name localhost;
9+
location /sum {
10+
set $a 44;
11+
echo $a;
12+
set $a 66;
13+
echo $a;
14+
}
15+
}
16+
17+
```
18+
19+
+ 实际的执行顺序是:
20+
```
21+
set $a 44;
22+
set $a 66;
23+
echo $a;
24+
echo $a;
25+
```
26+
+ 两个命令 设置在执行阶段`rewrite`,两个命令 回声在随后阶段执行`content`。不同阶段的命令无法执行。

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
- [ ] [nginx变量使用方法详解笔记(3)](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-2-config.md)
1717
- [ ] [nginx变量使用方法详解笔记(4)](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-2-config.md)
1818
- [ ] [nginx变量使用方法详解笔记(5)](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-2-config.md)
19+
+ Nginx指令执行顺序
20+
- [x] [Nginx指令执行命令(01)](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx-Develop/notes-1.md)
21+
- [x] [nginx变量使用方法详解笔记(2)](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx-Develop/notes-2.md)
22+
- [ ] [nginx变量使用方法详解笔记(3)](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-2-config.md)
23+
- [ ] [nginx变量使用方法详解笔记(4)](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-2-config.md)
24+
- [ ] [nginx变量使用方法详解笔记(5)](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-2-config.md)
1925
+ **Nginx高性能WEB服务器详解**
2026
+ 第一章 初探
2127
- [x] [Nginx的历史](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-2-config.md)

0 commit comments

Comments
 (0)
0