Varnish的用户友好错误页面 [英] User-friendly error pages from Varnish
本文介绍了Varnish的用户友好错误页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们在Plone的前面使用Varnish.如果Plone出现故障或出现内部错误,我们想显示一个用户友好的静态HTML页面,其中包含一些CSS样式+图片. (正在更新服务器页面")
We are using Varnish at the front of Plone. In the case Plone goes down or serves an internal error we'd like to show a user-friendly static HTML page which some CSS styling + images. ("The server is being updated page")
如何配置Varnish来做到这一点?
How to configure Varnish to do this?
推荐答案
您可以自定义在vlc_error上投放的综合页面. default.vcl配置文件已经显示了如何通过服务著名的大师冥想"错误页面(啊,那段美好的Amiga日子)来做到这一点.
You can customize the synthetic page being served on a vlc_error. The default.vcl configuration file already shows how to do this, by serving the famous "Guru Meditation" error page (ahh, those wonderful Amiga days).
自定义示例:
sub vcl_error {
set obj.http.Content-Type = "text/html; charset=utf-8";
synthetic {"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Sorry, server under maintainance - My Website"</title>
<style src="css/style.css"></style>
</head>
<body>
<h1>The server is being updated</h1>
<p>Please check back later. Meanwhile, here's a picture of a rabbit with a pancake on its head:</p>
<img src="img/wabbit.jpg" alt="awwwww!" />
</body>
</html>
"};
return (deliver);
}
这篇关于Varnish的用户友好错误页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文