Skip to content

Commit 9d48ef6

Browse files
authored
Merge pull request #31 from andrewshan/main
feat:更新readme
2 parents 7e4d2ba + dfbd0b2 commit 9d48ef6

File tree

2 files changed

+6
-83
lines changed

2 files changed

+6
-83
lines changed

README.md

Lines changed: 5 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,19 @@ Nginx网关是一个微服务网关。在原生Nginx的基础上,通过对接
88

99
## 支持的nginx版本
1010

11-
当前支持 nginx 的版本为>=1.4.7
11+
当前插件集成的版本为```nginx-1.23.1```
1212

13-
## 安装说明
13+
## 快速入门
1414

15-
### 操作系统支持
15+
快速入门指南可以参考:[nginx网关快速入门](https://polarismesh.cn/zh/doc/%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8/Nginx%E7%BD%91%E5%85%B3%E6%8E%A5%E5%85%A5.html#nginx%E7%BD%91%E5%85%B3%E6%8E%A5%E5%85%A5)
1616

17-
当前仅支持linux操作系统,linux下要求GCC版本>=4.8.5
18-
19-
```
20-
[sam@VM_15_118_centos ~/testgen]$ gcc --version
21-
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
22-
Copyright (C) 2015 Free Software Foundation, Inc.
23-
This is free software; see the source for copying conditions. There is NO
24-
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25-
```
26-
27-
### 下载安装包
28-
29-
可以直接从[releases](https://github.com/polarismesh/nginx-gateway/releases)下载最新的nginx网关安装包。
30-
31-
### 【可选】编译生成安装包
17+
## 编译指南
3218

3319
用户也可以通过源码编译的方式,生成安装包。
3420

3521
- 安装依赖项:在编译之前,需要先安装依赖项。通过执行```yum install autoconf automake libtool curl make gcc-c++ libstdc++-devel unzip```进行安装。
3622

37-
- 下载源码包:可以直接从[releases](https://github.com/polarismesh/nginx-gateway/releases)下载最新的nginx网关源码包
23+
- 下载源码包:可以直接从[releases](https://github.com/polarismesh/nginx-gateway/releases)下载最新的nginx源码包
3824

3925
- 编译安装:解压源码包。执行以下命令构建,构建过程需要连接网络下载依赖,请务必保证外网连通性。
4026

@@ -44,66 +30,3 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4430
```
4531

4632
- 获取编译结果:构建成功后,在源码包的根目录下,可以获取安装包:```nginx-gateway-release-*.tar.gz```
47-
48-
### 【可选】修改端口号
49-
50-
nginx默认端口号为80,如需修改端口号,可以通过编辑conf/nginx.conf配置文件进行修改。
51-
52-
```
53-
http {
54-
server {
55-
listen 80; #这里修改成希望监听的端口号
56-
}
57-
}
58-
```
59-
60-
### 运行安装包
61-
62-
解压安装包,并运行命令启动nginx网关。
63-
64-
```
65-
tar xf nginx-gateway-release-*.tar.gz
66-
cd nginx-gateway-release-*/sbin
67-
bash start.sh
68-
```
69-
70-
## 使用指南
71-
72-
### 使用访问限流功能
73-
74-
- 安装北极星
75-
76-
参考[安装指南](https://polarismesh.cn/zh/doc/%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8/%E5%AE%89%E8%A3%85%E6%9C%8D%E5%8A%A1%E7%AB%AF/%E5%AE%89%E8%A3%85%E5%8D%95%E6%9C%BA%E7%89%88.html#%E5%8D%95%E6%9C%BA%E7%89%88%E5%AE%89%E8%A3%85)进行安装。
77-
78-
- 配置限流规则
79-
80-
在北极星可视化控制台上配置限流规则,比如针对uri为```/test```的请求,限制每秒只能100QPS。参考[限流使用指南](https://polarismesh.cn/zh/doc/%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/%E8%AE%BF%E9%97%AE%E9%99%90%E6%B5%81/%E5%8D%95%E6%9C%BA%E9%99%90%E6%B5%81.html#%E5%8D%95%E6%9C%BA%E9%99%90%E6%B5%81)
81-
82-
- 修改nginx配置
83-
84-
通过修改nginx中的location,添加polaris_rate_limiting配置,启用北极星限流功能。
85-
```
86-
http {
87-
server {
88-
location / {
89-
polaris_rate_limiting namespace=default service=testcpp;
90-
}
91-
}
92-
}
93-
```
94-
95-
polaris_rate_limiting参数说明:
96-
97-
| 参数名 | 说明 | 是否必选 |
98-
| --------- | -------------------------------- | ----------------- |
99-
| service | 服务名,与限流规则服务名对应 ||
100-
| namespace | 命名空间,与限流规则命名空间对应 | 否,不填为default |
101-
102-
- 重启nginx
103-
104-
```
105-
cd nginx-gateway-release-*/sbin
106-
bash stop.sh
107-
bash start.sh
108-
```
109-

source/nginx_polaris_limit_module/ngx_http_polaris_limit_module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern "C" {
2929
#include <cstdlib>
3030
#include <mutex>
3131

32-
static const char KEY_ENABLE[] = "enable";
32+
static const char KEY_ENABLE[] = "enable=";
3333
static const uint32_t KEY_ENABLE_SIZE = sizeof(KEY_ENABLE) - 1;
3434
static const char KEY_NAMESPACE[] = "namespace=";
3535
static const uint32_t KEY_NAMESPACE_SIZE = sizeof(KEY_NAMESPACE) - 1;

0 commit comments

Comments
 (0)