apache - 如何将 Apache 网站设置为 503 "temporary down"?

标签 apache http configuration

RFC2616, 503 服务不可用

The server is currently unable to handle the request due to a temporary overloading or maintenance of the server

如何配置 Apache 2.2 以使用自定义 HTML 页面提供基于特定名称的虚拟主机 503 代码?

最佳答案

503 Temporarily Unavailable, with trigger

RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} !=503
RewriteCond "/srv/www/example.com/maintenance.trigger" -f
RewriteRule ^(.*)$ /$1 [R=503,L]

如果 maintenance.trigger 文件存在,Apache 将提供一个 503 Service Unavailable 响应。要提供自定义的“停机维护”页面,请使用 ErrorDocument 指定文件,如下所示:

ErrorDocument 503 /503_with_cats.html

尽情享受吧!

关于apache - 如何将 Apache 网站设置为 503 "temporary down"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/622466/

相关文章:

php - is_dir 在 apache 中的符号链接(symbolic link)上返回 false

PHP后台进程

java - Spring 移动 : how to add DeviceWebArgumentResolver programmatically?

java - 从自定义监听器捕获 log4j2 LogEvents

c# - Azure 环境上的 ConfigurationManager

apache - mod_auth_basic在https下是明文传输的吗?

php - 如何在 symfony2 中获取原生 php http 500 错误页面?

php - http post方法是如何实现的?

http - HTTP 中介的请求处理模型

javascript - http 模块(带有 browserify 的 node.js)不使用 PATCH 方法编写请求正文