您正在查看 Apigee Edge 文档。
转到
Apigee X 文档。 info
问题
Edge 路由器是使用 NGINX 实现的。在 Edge 升级过程中或
更改路由器的配置时,您可能会看到 NGINX 配置错误。发生这些
错误时,Edge 会将导致问题的所有 NGINX 配置文件标记为
/opt/nginx/conf.d:
-rw-r--r-- 1 apigee apigee 522 Jul 20 08:41 0-default.conf.bad -rw-r--r-- 1 apigee apigee 577 Jul 20 08:42 0-fallback.conf -rw-r--r-- 1 apigee apigee 1062 Jul 20 08:18 0-map.conf -rw-r--r-- 1 apigee apigee 1887 Jul 20 08:42 custorg_test_default.conf.bad
错误消息
您不会看到任何错误消息。但是,由于配置文件错误,您可能无法执行 API 代理。
可能的原因
通常,NGINX 配置文件会被标记为错误,原因是在
NGINX 属性中设置了不正确的值,这些属性位于 /opt/apigee/customer/application/router.properties 文件中
,或者对虚拟主机进行了不正确的更改。
诊断
- 从
/opt/nginx/conf.d目录中的文件名中移除 .bad 后缀,使其以 .conf 结尾。
- 运行 NGINX configtest 工具,以确定失败的原因:
/opt/nginx/scripts/apigee-nginx configtest
分辨率
- 如果配置测试确定了配置文件错误的原因,请通过对
/opt/apigee/customer/application/router.properties文件或虚拟主机中的特定属性进行适当的更改来解决此问题。
- 移除
/opt/nginx/conf.d目录:rm -rf /opt/nginx/conf.d
- 重启路由器:
/opt/apigee/apigee-service/bin/apigee-service edge-router restart
- 您应该不会再在
/opt/nginx/conf.d目录中看到错误的配置文件。
如果问题仍然存在,请与 Apigee Edge 支持团队联系。
以下示例展示了如何根据 NGINX 配置测试提供的信息来解决问题。
示例 1:为 NGINX 属性设置了不正确的值
- 假设您在
/opt/apigee/customer/application/router.properties文件中将属性“proxy_busy_buffers_size”更新为 128K,如下所示:conf_load_balancing_load.balancing.driver.proxy.busy.buffer.size=128k
这会导致配置文件在 /opt/apigee/nginx/conf.d
目录中被标记为错误。
- 运行 NGINX configtest 命令,以确定失败的原因:
/opt/nginx/scripts/apigee-nginx configtest nginx: [emerg] "proxy_busy_buffers_size" must be equal to or greater than the maximum of the value of "proxy_buffer_size" and one of the "proxy_buffers" in /opt/nginx/conf/nginx.conf:47 nginx: configuration file /opt/nginx/conf/nginx.conf test failed
configtest 结果表明,属性 proxy_busy_buffers_size 的值应等于或大于 proxy_buffer_size ,但似乎设置了不正确的值。
- 检查为属性
proxy_buffer_size 和 proxy_busy_buffers_size
在
0-default.conf文件中设置的值:proxy_buffer_size 512k; proxy_busy_buffers_size 128k;
- 在
/opt/apigee/customer/application/router.properties文件中将 proxy_busy_buffers_size 的值更新为 512K:conf_load_balancing_load.balancing.driver.proxy.busy.buffer.size=512k
- 移除
/opt/nginx/conf.d文件夹:rm -rf /opt/nginx/conf.d
- 重启路由器:
/opt/apigee/apigee-service/bin/apigee-service edge-router restart
问题已解决,错误的配置文件已移除。
示例 2:升级 NGINX 的过程失败(仅限 Private Cloud 18.01)
假设您运行 configtest 并收到以下响应:
/apigee-nginx configtest nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok nginx: [emerg] zero size shared memory zone "perclient" nginx: configuration file /opt/nginx/conf/nginx.conf test failed
此失败表明,该过程未能将 NGINX 从 1.10.x 升级到 1.12.x。 存在与将 Edge Private Cloud 升级到 18.01 版相关的已知 bug。
如需正确诊断此问题(仅当您使用的是 Private Cloud 18.01 时),请执行以下操作:
rpm -aq | grep apigee-nginx
此命令应返回已安装的 rpm 作为版本 1.12.x。如果未返回,请按以下步骤操作:
- 停止 edge-router 组件。
- 备份 edge-router 组件。
- 运行以下命令以升级到 apigee-nginx 1.2.x:
- 删除
/opt/apigee/nginx/conf.d.下的所有*.bad文件。 - 重启 edge-router 组件。
sudo yum update apigee-nginx