在Networking
-> Load Balancin
g ->中Host and path rules
,我定義了一個 url 映射來將 '/'、'/blog/'、'features/' 和 '/pricing/' 對應到 WordPress 後端/
但是,當我新增“/”的配置測試時,我收到以下錯誤訊息:
我的目的是有幾個眾所周知的 url 映射到 WordPress 後端,其餘的則定向到另一個後端服務。
為什麼上面規則中的「/」沒有將「www.examples.com/」對應到 wordpress 服務?
編輯
1)按照 Grisha Levit 在評論中的要求
>> gcloud compute backend-services describe backend-service-url-mapper
affinityCookieTtlSec: 0
backends:
- balancingMode: UTILIZATION
capacityScaler: 1.0
description: ''
group: https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-c/instanceGroups/instance-group-forward-to-gae
maxUtilization: 0.8
connectionDraining:
drainingTimeoutSec: 300
creationTimestamp: '2017-01-16T18:18:24.815-08:00'
description: ''
enableCDN: false
fingerprint: jx1UyRlAaXY=
healthChecks:
- https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/health-check-wordpress
id: '5709193638199738399'
kind: compute#backendService
loadBalancingScheme: EXTERNAL
name: backend-service-url-mapper
port: 80
portName: http
protocol: HTTP
selfLink: https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/backend-service-url-mapper
sessionAffinity: NONE
timeoutSec: 30
它基本上是一堆 nginx 伺服器。
2)以下是所有規則的完整圖片:
答案1
像這樣的設定對我來說很有效,使用兩個後端(NGINX 和 Apache)
HTTP 請求被重新導向如下:
http://test.mydomain.com/ 至 NGINX
http://test.mydomain.com/blog 到 NGINX
http://test.mydomain.com/pricing 到 NGINX
http://test.mydomain.com/anything 到阿帕契
運行狀況檢查可能需要幾分鐘才能正常工作,並且負載平衡器可能需要幾分鐘才能更新新設定。參考文件可以找到這裡。