設定檔錯誤

您正在查看 Apigee Edge 說明文件。
查看 Apigee X 說明文件
資訊

問題

邊緣路由器是透過 NGINX 實作。在邊緣升級程序期間,或是變更路由器的設定時,您可能會看到 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 Proxy。

可能原因

一般而言,NGINX 設定檔標示為錯誤的原因,是因為 /opt/apigee/customer/application/router.properties 檔案中的值設為 NGINX 屬性,或是虛擬主機的變更不正確。

診斷

  1. /opt/nginx/conf.d 目錄中的檔案名稱中移除 .bad 後置字串,使其結尾是 .conf。
  1. 執行 NGINX configtest 工具,找出失敗的原因:
    /opt/nginx/scripts/apigee-nginx configtest
    

解析度

  1. 如果設定測試找出設定檔錯誤的原因,請適當變更 /opt/apigee/customer/application/router.properties 檔案或虛擬主機中的特定屬性,藉此修正問題。
  1. 移除 /opt/nginx/conf.d 目錄:
    rm -rf /opt/nginx/conf.d
    
  1. 重新啟動路由器:
    /opt/apigee/apigee-service/bin/apigee-service edge-router restart
    
  1. 您應該不會再在 /opt/nginx/conf.d 目錄中看到錯誤設定檔。

如果問題持續發生,請與 Apigee Edge 支援團隊聯絡。

以下範例說明如何根據 NGINX 設定測試提供的資訊修正問題。

示例 1:NGINX 屬性的值設定不正確

  1. 假設您已將 /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 目錄中的設定檔標示為錯誤。

  1. 執行 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
    

設定測試結果顯示,proxy_busy_buffers_size 屬性的值應等於或大於 proxy_busy_buffers_size,但設定的值似乎不正確。

  1. 檢查 0-default.conf 檔案中 proxy_buffer_sizeproxy_office_buffers_size 屬性值設定的值:
    proxy_buffer_size 512k;
    proxy_busy_buffers_size 128k;
    
  1. /opt/apigee/customer/application/router.properties 檔案中的 Proxy_buzz_buffers_size 的值更新為 512K:
    conf_load_balancing_load.balancing.driver.proxy.busy.buffer.size=512k
    
  1. 移除 /opt/nginx/conf.d 資料夾:
    rm -rf /opt/nginx/conf.d
    
  1. 重新啟動路由器:
    /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 版有已知的錯誤。

如要正確診斷這個問題 (僅適用於使用 Private Cloud 18.01 的情況),請按照下列步驟操作:

rpm -aq | grep apigee-nginx

這個指令應會傳回已安裝的 rpm 為 1.12.x 版。否則,請按照下列步驟進行:

  1. 停止邊緣路由器元件。
  2. 備份邊緣路由器元件。
  3. 執行下列指令,升級至 apigee-nginx 1.2.x:
  4. sudo yum update apigee-nginx
  5. 刪除「/opt/apigee/nginx/conf.d.」下的全部 *.bad 個檔案
  6. 重新啟動 Edge-router 元件。