作者:手机用户2502871993 | 来源:互联网 | 2023-02-06 14:35
我在端口80上运行Varnish,在同一台机器上运行8088端口的Apache(我用它进行开发/测试).
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设置:
ServerAdmin admin@example.org
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
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
任何想法都赞赏.
谢谢,
1> Danila Versh..:
如果返回HTTP状态,则探测成功200 OK
.目前,您的探针会重定向,302 Found
因此它会将后端标记为生病.
您需要确保curl -IL http://127.0.0.1:8088/ -H "magento2.dev"
不返回任何重定向.(Magento设置?)
以下命令在对病态后端进行故障排除时更有用,因为它将显示返回的HTTP状态:
varnishlog -g raw -i Backend_health