如果看起來相當愚蠢的話,那麼對於Varnish來說,這是一個很好的道理。清漆3和多個IP(虛擬主機)對我來說工作不太好
這裏的情況。我有一個有5個IP的服務器。對於大多數任務使用ISPconfig,但這可能無關緊要。
我在多個IP上配置了多個apache虛擬主機。
問題是varnish正在發佈503,在任何非默認虛擬主機上獲取錯誤無後端連接(根據varnishlog),即在虛擬主機中定義了靜態IP的虛擬主機。任何*:8080虛擬主機工作正常。所以我錯過了某個地方。儘管路徑看起來正確,但所有虛擬主機錯誤日誌顯示文件都不存在錯誤。
建議非常感謝。
我當然有手動編輯所有的虛擬主機條目並相應配置,即
<VirtualHost 00.11.22.33:8080>
DocumentRoot /var/www/shop.example1.com/web
這裏是我的VCL配置
backend default {
.host = "127.0.0.1";
.port = "8080";
}
backend example1 {
.host = "00.11.22.33";
.port = "8080";
}
backend example2 {
.host = "11.22.33.44";
.port = "8080";
}
acl purge {
"localhost";
}
sub vcl_recv {
if (req.http.host ~ "(?i)^(www.)?example1.com")
{
set req.http.host = "www.example1.com";
set req.backend = example1;
}
if (req.http.Host ~ "shop\.example2\.com")
{
set req.http.Host = "shop.example2.com";
set req.backend = example2;
}
set req.grace = 2m;
set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;]*", "");
set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");
if (req.url ~ "/wp-(login|admin|cron)") {
return (pass);
}
set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-1=[^;]+(;)?", "");
set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-time-1=[^;]+(;)?", "");
set req.http.Cookie = regsuball(req.http.Cookie, "wordpress_test_cookie=[^;]+(;)?", "");
if (req.url ~ "wp-content/themes/" && req.url ~ "\.(css|js|png|gif|jp(e)?g)") {
.......
'
下面是從漆日誌摘錄:'VCL_call C小姐回了取 11 FetchError C無後端連接 11 VCL_call c出錯提供 11 VCL_call c提供傳送 11 TxProtocol c HTTP/1.1 11 TxStatus c 503 11 TxResponse c服務不可用 '我在這裏錯過了一些明顯的東西。 – Nik