手把手教你Nginx常用模块详解之ngx_http_api_module(三)(下)

简介: 手把手教你Nginx常用模块详解之ngx_http_api_module(三)

/http/upstreams/{httpUpstreamName}/servers/共同为所有方法参数:httpUpstreamName(string所需)的上游服务器组的名称。

支持的方法:


GET - 返回HTTP上游服务器组中所有服务器的配置返回特定HTTP上游服务器组中每个服务器的配置。可能的回应:

- 200 - Success, returns an array of [HTTP Upstream Servers](about:blank#def_nginx_http_upstream_conf_server) 
- 400 - Upstream is static (`UpstreamStatic`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), returns [Error](about:blank#def_nginx_error) 

POST - 将服务器添加到HTTP上游服务器组将新服务器添加到HTTP上游服务器组。服务器参数以JSON格式指定。请求参数:( postHttpUpstreamServerHTTP上游服务器,必需)新服务器的地址和JSON格式的其他可选参数。“ ID”,“ backup”和“ service”参数不能更改。可能的回应:

- 201 - Created, returns [HTTP Upstream Server](about:blank#def_nginx_http_upstream_conf_server) 
- 400 - Upstream is static (`UpstreamStatic`), invalid “_`parameter`_” value (`UpstreamConfFormatError`), missing “`server`” argument (`UpstreamConfFormatError`), unknown parameter “_`name`_” (`UpstreamConfFormatError`), nested object or list (`UpstreamConfFormatError`), “`error`” while parsing (`UpstreamBadAddress`), service upstream “`host`” may not have port (`UpstreamBadAddress`), service upstream “`host`” requires domain name (`UpstreamBadAddress`), invalid “`weight`” (`UpstreamBadWeight`), invalid “`max_conns`” (`UpstreamBadMaxConns`), invalid “`max_fails`” (`UpstreamBadMaxFails`), invalid “`fail_timeout`” (`UpstreamBadFailTimeout`), invalid “`slow_start`” (`UpstreamBadSlowStart`), route is too long (`UpstreamBadRoute`), “`service`” is empty (`UpstreamBadService`), no resolver defined to resolve (`UpstreamConfNoResolver`), upstream “_`name`_” has no backup (`UpstreamNoBackup`), upstream “_`name`_” memory exhausted (`UpstreamOutOfMemory`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), returns [Error](about:blank#def_nginx_error) 
- 405 - Method disabled (`MethodDisabled`), returns [Error](about:blank#def_nginx_error) 
- 415 - JSON error (`JsonError`), returns [Error](about:blank#def_nginx_error) 


/http/upstreams/{httpUpstreamName}/servers/{httpUpstreamServerId}共同为所有方法参数:httpUpstreamName(string所需)上游服务器组的名称。httpUpstreamServerId(string,必填)服务器的ID。

支持的方法:


GET - 返回HTTP上游服务器组中服务器的配置返回HTTP上游服务器组中特定服务器的配置。可能的回应:

- 200 - Success, returns [HTTP Upstream Server](about:blank#def_nginx_http_upstream_conf_server) 
- 400 - Upstream is static (`UpstreamStatic`), invalid server ID (`UpstreamBadServerId`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), server with ID “_`id`_” does not exist (`UpstreamServerNotFound`), returns [Error](about:blank#def_nginx_error) 

PATCH - 修改HTTP上游服务器组中的服务器修改HTTP上游服务器组中特定服务器的设置。服务器参数以JSON格式指定。请求参数:( patchHttpUpstreamServerHTTP上游服务器,必需)服务器参数,以JSON格式指定。“ ID”,“ backup”和“ service”参数不能更改。可能的回应:

- 200 - Success, returns [HTTP Upstream Server](about:blank#def_nginx_http_upstream_conf_server) 
- 400 - Upstream is static (`UpstreamStatic`), invalid “_`parameter`_” value (`UpstreamConfFormatError`), unknown parameter “_`name`_” (`UpstreamConfFormatError`), nested object or list (`UpstreamConfFormatError`), “`error`” while parsing (`UpstreamBadAddress`), invalid “`server`” argument (`UpstreamBadAddress`), invalid server ID (`UpstreamBadServerId`), invalid “`weight`” (`UpstreamBadWeight`), invalid “`max_conns`” (`UpstreamBadMaxConns`), invalid “`max_fails`” (`UpstreamBadMaxFails`), invalid “`fail_timeout`” (`UpstreamBadFailTimeout`), invalid “`slow_start`” (`UpstreamBadSlowStart`), route is too long (`UpstreamBadRoute`), “`service`” is empty (`UpstreamBadService`), server “_`ID`_” address is immutable (`UpstreamServerImmutable`), server “`ID`” weight is immutable (`UpstreamServerWeightImmutable`), upstream “`name`” memory exhausted (`UpstreamOutOfMemory`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), server with ID “_`id`_” does not exist (`UpstreamServerNotFound`), returns [Error](about:blank#def_nginx_error) 
- 405 - Method disabled (`MethodDisabled`), returns [Error](about:blank#def_nginx_error) 
- 415 - JSON error (`JsonError`), returns [Error](about:blank#def_nginx_error) 
  • DELETE - 从HTTP上游服务器组中删除服务器从HTTP上游服务器组中删除服务器。可能的回应:
- 200 - Success, returns an array of [HTTP Upstream Servers](about:blank#def_nginx_http_upstream_conf_server) 
- 400 - Upstream is static (`UpstreamStatic`), invalid server ID (`UpstreamBadServerId`), server “_`id`_” not removable (`UpstreamServerImmutable`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), server with ID “_`id`_” does not exist (`UpstreamServerNotFound`), returns [Error](about:blank#def_nginx_error) 
- 405 - Method disabled (`MethodDisabled`), returns [Error](about:blank#def_nginx_error) 


/http/keyvals/

支持的方法:

-GET - 从所有keyval区域返回键值对每个keyval共享内存区域返回键值对。请求参数: fields(string,可选)如果“ fields”值为空,那么只有KEYVAL区名称输出。可能的回应:

- 200 - Success, returns a collection of "[Keyval Shared Memory Zone](about:blank#def_nginx_http_keyval_zone)" objects for all http keyvals 


/http/keyvals/{httpKeyvalZoneName}共同为所有方法参数:httpKeyvalZoneName(string所需)一个KEYVAL共享存储器区域的名称。

支持的方法:


GET - 从keyval区域返回键值对返回存储在特定keyval共享内存区域中的键值对。请求参数: key(string,可选)获得从所述KEYVAL区一个特定的键-值对。可能的回应:


- 200 - Success, returns [Keyval Shared Memory Zone](about:blank#def_nginx_http_keyval_zone) 
- 404 - Keyval not found (`KeyvalNotFound`), keyval key not found (`KeyvalKeyNotFound`), returns [Error](about:blank#def_nginx_error) 

POST - 向keyval区域添加键值对将新的键值对添加到keyval共享内存区域。如果keyval共享内存区域为空,则可以输入多个键值对。请求参数:( Key-valueKeyval Shared Memory Zone,必需)键值对以JSON格式指定。如果keyval共享内存区域为空,则可以输入多个键值对。可能的回应:

- 201 - Created
- 400 - Key required (`KeyvalFormatError`), only one key can be added (`KeyvalFormatError`), nested object or list (`KeyvalFormatError`), returns [Error](about:blank#def_nginx_error) 
- 404 - Keyval not found (`KeyvalNotFound`), returns [Error](about:blank#def_nginx_error) 
- 405 - Method disabled (`MethodDisabled`), returns [Error](about:blank#def_nginx_error) 
- 409 - Key already exists (`KeyvalKeyExists`), returns [Error](about:blank#def_nginx_error) 
- 415 - JSON error (`JsonError`), returns [Error](about:blank#def_nginx_error) 

PATCH- 修改键值或删除键更改键值对中所选键的值或通过将键值设置为来删除键null。请求参数: httpKeyvalZoneKeyValue(Keyval共享内存区域,必需)以JSON格式指定键的新值。可能的回应:

- 204 - Success
- 400 - Key required (`KeyvalFormatError`), only one key can be updated (`KeyvalFormatError`), nested object or list (`KeyvalFormatError`), returns [Error](about:blank#def_nginx_error) 
- 404 - Keyval not found (`KeyvalNotFound`), keyval key not found (`KeyvalKeyNotFound`), returns [Error](about:blank#def_nginx_error) 
- 405 - Method disabled (`MethodDisabled`), returns [Error](about:blank#def_nginx_error) 
- 415 - JSON error (`JsonError`), returns [Error](about:blank#def_nginx_error) 
  • DELETE - 清空keyval区域从keyval共享内存区域中删除所有键值对。可能的回应:
- 204 - Success
- 404 - Keyval not found (`KeyvalNotFound`), returns [Error](about:blank#def_nginx_error) 
- 405 - Method disabled (`MethodDisabled`), returns [Error](about:blank#def_nginx_error) 


/stream/

支持的方法:

GET - 与流相关的端点的返回列表返回第一级流终端列表。可能的回应:

- 200 - Success, returns an array of strings


/stream/server_zones/

支持的方法:

  • GET - 返回所有流服务器区域的状态返回每个流服务器区域的状态信息。请求参数: fields(string,可选)限制了服务器区域的字段将被输出。如果“ fields”值为空,则仅输出服务器区域名称。可能的回应:
- 200 - Success, returns a collection of "[Stream Server Zone](about:blank#def_nginx_stream_server_zone)" objects for all stream server zones 
- 404 - [stream](../stream/ngx_stream_core_module#stream) not configured (`StreamNotConfigured`), returns [Error](about:blank#def_nginx_error) 


/stream/server_zones/{streamServerZoneName}通用于所有方法的参数:streamServerZoneName(string所需)流服务器区域的名称。

支持的方法:


GET - 返回流服务器区域的状态返回特定流服务器区域的状态。请求参数: fields(string,可选)限制了服务器区的字段将被输出。可能的回应:

- 200 - Success, returns [Stream Server Zone](about:blank#def_nginx_stream_server_zone) 
- 404 - Server zone not found (`ServerZoneNotFound`), [stream](../stream/ngx_stream_core_module#stream) not configured (`StreamNotConfigured`), returns [Error](about:blank#def_nginx_error) 
  • DELETE - 重置流服务器区域的统计信息重置特定流服务器区域中接受和丢弃的连接,会话,接收和发送字节的统计信息。可能的回应:
- 204 - Success
- 404 - Server zone not found (`ServerZoneNotFound`), [stream](../stream/ngx_stream_core_module#stream) not configured (`StreamNotConfigured`), returns [Error](about:blank#def_nginx_error) 
- 405 - Method disabled (`MethodDisabled`), returns [Error](about:blank#def_nginx_error) 


/stream/upstreams/

支持的方法:

-GET - 返回所有流上游服务器组的状态返回每个流上游服务器组及其服务器的状态。请求参数: fields(string,可选)限制了上游服务器组的字段将被输出。如果“ fields”值为空,则仅输出上游名称。可能的回应:

- 200 - Success, returns a collection of "[Stream Upstream](about:blank#def_nginx_stream_upstream)" objects for all stream upstreams 
- 404 - [stream](../stream/ngx_stream_core_module#stream) not configured (`StreamNotConfigured`), returns [Error](about:blank#def_nginx_error) 


/stream/upstreams/{streamUpstreamName}/共同为所有方法参数:streamUpstreamName(string所需)流上游服务器组的名称。

支持的方法:


GET - 返回流上游服务器组的状态返回特定流上游服务器组及其服务器的状态。请求参数: fields(string,可选)限制了上游服务器组的字段将被输出。可能的回应:

- 200 - Success, returns [Stream Upstream](about:blank#def_nginx_stream_upstream) 
- 400 - Upstream is static (`UpstreamStatic`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), [stream](../stream/ngx_stream_core_module#stream) not configured (`StreamNotConfigured`), returns [Error](about:blank#def_nginx_error) 
  • DELETE - 重置流上游服务器组的统计信息重置上游服务器组中每个上游服务器的统计信息。可能的回应:
- 204 - Success
- 400 - Upstream is static (`UpstreamStatic`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), [stream](../stream/ngx_stream_core_module#stream) not configured (`StreamNotConfigured`), returns [Error](about:blank#def_nginx_error) 
- 405 - Method disabled (`MethodDisabled`), returns [Error](about:blank#def_nginx_error) 


/stream/upstreams/{streamUpstreamName}/servers/共同为所有方法参数:streamUpstreamName(string所需)的上游服务器组的名称。

支持的方法:


GET - 返回流上游服务器组中所有服务器的配置返回特定流上游服务器组中每个服务器的配置。可能的回应:

- 200 - Success, returns an array of [Stream Upstream Servers](about:blank#def_nginx_stream_upstream_conf_server) 
- 400 - Upstream is static (`UpstreamStatic`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), [stream](../stream/ngx_stream_core_module#stream) not configured (`StreamNotConfigured`), returns [Error](about:blank#def_nginx_error) 

POST - 将服务器添加到流上游服务器组,将新服务器添加到流上游服务器组。服务器参数以JSON格式指定。请求参数:( postStreamUpstreamServer流上游服务器,必需)新服务器的地址和JSON格式的其他可选参数。“ ID”,“ backup”和“ service”参数不能更改。可能的回应:

- 201 - Created, returns [Stream Upstream Server](about:blank#def_nginx_stream_upstream_conf_server) 
- 400 - Upstream is static (`UpstreamStatic`), invalid “_`parameter`_” value (`UpstreamConfFormatError`), missing “`server`” argument (`UpstreamConfFormatError`), unknown parameter “_`name`_” (`UpstreamConfFormatError`), nested object or list (`UpstreamConfFormatError`), “`error`” while parsing (`UpstreamBadAddress`), no port in server “`host`” (`UpstreamBadAddress`), service upstream “`host`” may not have port (`UpstreamBadAddress`), service upstream “`host`” requires domain name (`UpstreamBadAddress`), invalid “`weight`” (`UpstreamBadWeight`), invalid “`max_conns`” (`UpstreamBadMaxConns`), invalid “`max_fails`” (`UpstreamBadMaxFails`), invalid “`fail_timeout`” (`UpstreamBadFailTimeout`), invalid “`slow_start`” (`UpstreamBadSlowStart`), “`service`” is empty (`UpstreamBadService`), no resolver defined to resolve (`UpstreamConfNoResolver`), upstream “_`name`_” has no backup (`UpstreamNoBackup`), upstream “_`name`_” memory exhausted (`UpstreamOutOfMemory`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), [stream](../stream/ngx_stream_core_module#stream) not configured (`StreamNotConfigured`), returns [Error](about:blank#def_nginx_error) 
- 405 - Method disabled (`MethodDisabled`), returns [Error](about:blank#def_nginx_error) 
- 415 - JSON error (`JsonError`), returns [Error](about:blank#def_nginx_error) 


/stream/upstreams/{streamUpstreamName}/servers/{streamUpstreamServerId}共同为所有方法参数:streamUpstreamName(string所需)上游服务器组的名称。streamUpstreamServerId(string,必填)服务器的ID。

支持的方法:


GET - 返回流上游服务器组中服务器的配置返回流上游服务器组中特定服务器的配置。可能的回应:

- 200 - Success, returns [Stream Upstream Server](about:blank#def_nginx_stream_upstream_conf_server) 
- 400 - Upstream is static (`UpstreamStatic`), invalid server ID (`UpstreamBadServerId`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), server with ID “_`id`_” does not exist (`UpstreamServerNotFound`), [stream](../stream/ngx_stream_core_module#stream) not configured (`StreamNotConfigured`), returns [Error](about:blank#def_nginx_error) 

PATCH - 修改流上游服务器组中的服务器,修改流上游服务器组中特定服务器的设置。服务器参数以JSON格式指定。请求参数:( patchStreamUpstreamServer流上游服务器,必需)服务器参数,以JSON格式指定。“ ID”,“ backup”和“ service”参数不能更改。可能的回应:

- 200 - Success, returns [Stream Upstream Server](about:blank#def_nginx_stream_upstream_conf_server) 
- 400 - Upstream is static (`UpstreamStatic`), invalid “_`parameter`_” value (`UpstreamConfFormatError`), unknown parameter “_`name`_” (`UpstreamConfFormatError`), nested object or list (`UpstreamConfFormatError`), “`error`” while parsing (`UpstreamBadAddress`), invalid “`server`” argument (`UpstreamBadAddress`), no port in server “`host`” (`UpstreamBadAddress`), invalid server ID (`UpstreamBadServerId`), invalid “`weight`” (`UpstreamBadWeight`), invalid “`max_conns`” (`UpstreamBadMaxConns`), invalid “`max_fails`” (`UpstreamBadMaxFails`), invalid “`fail_timeout`” (`UpstreamBadFailTimeout`), invalid “`slow_start`” (`UpstreamBadSlowStart`), “`service`” is empty (`UpstreamBadService`), server “_`ID`_” address is immutable (`UpstreamServerImmutable`), server “_`ID`_” weight is immutable (`UpstreamServerWeightImmutable`), upstream “`name`” memory exhausted (`UpstreamOutOfMemory`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), server with ID “_`id`_” does not exist (`UpstreamServerNotFound`), [stream](../stream/ngx_stream_core_module#stream) not configured (`StreamNotConfigured`), returns [Error](about:blank#def_nginx_error) 
- 405 - Method disabled (`MethodDisabled`), returns [Error](about:blank#def_nginx_error) 
- 415 - JSON error (`JsonError`), returns [Error](about:blank#def_nginx_error) 
  • DELETE - 从流上游服务器组中删除服务器,从流服务器组中删除服务器。可能的回应:
- 200 - Success, returns an array of [Stream Upstream Servers](about:blank#def_nginx_stream_upstream_conf_server) 
- 400 - Upstream is static (`UpstreamStatic`), invalid server ID (`UpstreamBadServerId`), server “_`id`_” not removable (`UpstreamServerImmutable`), returns [Error](about:blank#def_nginx_error) 
- 404 - Upstream not found (`UpstreamNotFound`), server with ID “_`id`_” does not exist (`UpstreamServerNotFound`), [stream](../stream/ngx_stream_core_module#stream) not configured (`StreamNotConfigured`), returns [Error](about:blank#def_nginx_error) 
- 405 - Method disabled (`MethodDisabled`), returns [Error](about:blank#def_nginx_error) 

其他参考文档,以上就不再列出了。

以上更多详解请大家关注nginx官方网站https://nginx.org/en/docs/


    以上就是我们今天的教程,如果本文对你有所帮助,欢迎关注点赞,分享给您身边的朋友。您的鼓励就是对我的最大动力。

相关文章
|
2月前
|
负载均衡 应用服务中间件 API
Nginx:location配置模块的用法(一)
Nginx:location配置模块的用法(一)
257 2
|
2月前
|
缓存 应用服务中间件 nginx
安装nginx-http-flv-module模块
本文介绍如何为Nginx安装`nginx-http-flv-module`模块。此模块基于`nginx-rtmp-module`二次开发,不仅具备原模块的所有功能,还支持HTTP-FLV播放、GOP缓存、虚拟主机等功能。安装步骤包括:确认Nginx版本、下载相应版本的Nginx与模块源码、重新编译Nginx并加入新模块、验证模块安装成功。特别注意,此模块已包含`nginx-rtmp-module`功能,无需重复编译安装。
91 1
|
2月前
|
JSON API 数据格式
Python网络编程:HTTP请求(requests模块)
在现代编程中,HTTP请求几乎无处不在。无论是数据抓取、API调用还是与远程服务器进行交互,HTTP请求都是不可或缺的一部分。在Python中,requests模块被广泛认为是发送HTTP请求的最简便和强大的工具之一。本文将详细介绍requests模块的功能,并通过一个综合示例展示其应用。
|
2月前
|
前端开发 API 网络架构
【Azure 应用服务】能否通过 Authentication 模块配置 Azure AD 保护 API 应用?
【Azure 应用服务】能否通过 Authentication 模块配置 Azure AD 保护 API 应用?
|
2月前
|
负载均衡 应用服务中间件 Linux
在Linux中,常用的 Nginx 模块有哪些,常来做什么?
在Linux中,常用的 Nginx 模块有哪些,常来做什么?
|
2月前
|
缓存 应用服务中间件 API
Nginx七层(应用层)反向代理:HTTP反向代理proxy_pass篇(三)
Nginx七层(应用层)反向代理:HTTP反向代理proxy_pass篇(三)
34 3
|
2月前
|
缓存 前端开发 应用服务中间件
Nginx:location配置模块的用法(二)
Nginx:location配置模块的用法(二)
46 2
|
2月前
|
缓存 安全 应用服务中间件
Nginx七层(应用层)反向代理:HTTP反向代理proxy_pass篇(二)
Nginx七层(应用层)反向代理:HTTP反向代理proxy_pass篇(二)
31 1
|
2月前
|
运维 算法 应用服务中间件
运维系列.Nginx中使用HTTP压缩功能(一)
运维系列.Nginx中使用HTTP压缩功能(一)
35 1
|
2月前
|
Kubernetes 监控 API
在k8S中,各模块如何与API Server进行通信的?
在k8S中,各模块如何与API Server进行通信的?
下一篇
无影云桌面