2017-04-17 77 views
1

我有端口80上運行的清漆和運行在同一臺機器上的端口8088上的Apache(我用它進行開發/測試)。清漆探針總是返回生病的後端

阿帕奇被定義爲VCL後端如下:

backend default { 
    .host = "127.0.0.1"; 
    .port = "8088"; 
    .first_byte_timeout = 600s; 
    .probe = { 
     .request = "GET /index.php HTTP/1.1" 
       "Host: example.com" 
       "Connection: close"; 
     .interval = 5s; 
     .timeout = 1s; 
     .window = 10; 
     .threshold = 8; 
    } 
} 

正如你可以看到我有一個探頭設置。但是,當我做varnishadm backend.list我得到

Backend name     Refs Admin  Probe 
default(127.0.0.1,,8088)  1  probe  Sick 0/10 

當我執行的wget 127.0.0.1:8088我得到

--2017-04-17 10:20:20-- http://127.0.0.1:8088/ 
Connecting to 127.0.0.1:8088... connected. 
HTTP request sent, awaiting response... 302 Found 
Location: http://magento2.dev/?SID=obcv7ifsq5b4ro9jr3hmpb7oi4 [following] 
--2017-04-17 10:20:20-- http://magento2.dev/?SID=obcv7ifsq5b4ro9jr3hmpb7oi4 
Resolving magento2.dev... 127.0.53.53 
Connecting to magento2.dev|127.0.53.53|:80... connected. 
HTTP request sent, awaiting response... 503 Backend fetch failed 
2017-04-17 10:20:20 ERROR 503: Backend fetch failed. 

所以它可能是探頭接收503錯誤?由於該請求將使用Varnish而不是Apache。還是我在這裏錯了?

爲了記錄在案,這裏是我的虛擬主機設置爲Apache:

<VirtualHost *:8088> 
    ServerAdmin [email protected] 
    ServerName magento2.dev 
    ServerAlias www.magento2.dev 
    DocumentRoot "/var/www/magento2/" 
     CustomLog /var/log/httpd/magento2.dev-access.log combined 
     ErrorLog /var/log/httpd/magento2.dev-error.log 
    <Directory "/var/www/magento2/"> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

讚賞任何想法。

感謝,

回答

4

探測器是成功的,如果返回的HTTP狀態200 OK。目前您的探針會重定向302 Found,因此它會將後端標記爲不適。

您需要確保curl -IL http://127.0.0.1:8088/ -H "magento2.dev"不返回任何重定向。 (Magento的設置嗎?)

下面的命令在排除故障時生病後端更加有用,因爲它會告訴你返回的HTTP狀態:

varnishlog -g raw -i Backend_health