简体   繁体   English

在 apache 中服务器不同的 503 页

[英]server different 503 pages in apache

i have two apps using the below apache config, app1 listening on 3030 and app2 listening on 3031.我有两个应用程序使用下面的 apache 配置,app1 在 3030 上监听,app2 在 3031 上监听。

i would like to server different 503 pages for app1 and app2, when i add ErrorDocument 503 /503.html its affecting both app1 and app2, what can be done to server different 503 for app1 and app2我想为 app1 和 app2 提供不同的 503 页面,当我添加ErrorDocument 503 /503.html它同时影响 app1 和 app2 时,可以做些什么来为 app1 和 app2 提供不同的 503

ProxyPass /app1 http://127.0.0.1:3030
ProxyPassReverse /app1 http://127.0.0.1:3030
ProxyPass /app2 http://127.0.0.1:3031
ProxyPassReverse /app2 http://127.0.0.1:3031

Bitnami Engineer here, Bitnami 工程师在这里,

If you want different 503 HTMLs for each app, you can use the following code in the /opt/bitnami/apache2/conf/bitnami/bitnami.conf file如果您希望每个应用程序使用不同的 503 HTML,可以在 /opt/bitnami/apache2/conf/bitnami/bitnami.conf 文件中使用以下代码

  ProxyPass /app1 http://127.0.0.1:3000
  ProxyPassReverse /app1 http://127.0.0.1:3000
  ProxyPass /app2 http://127.0.0.1:3001
  ProxyPassReverse /app2 http://127.0.0.1:3001
  ProxyErrorOverride On
  <Location /app1>
  ErrorDocument 503 /503_custom.html
  </Location>
  <Location /app2>
  ErrorDocument 503 /503.html
  </Location>

I just tried that code with this example express app我刚刚用这个示例快递应用程序尝试了该代码

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {
  res.sendStatus(503);
})

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`)
})

As you can see, it was returning a 503 error code and Apache managed it to send the 503_custom.html site.如您所见,它返回了 503 错误代码,并且 Apache 管理它发送 503_custom.html 站点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM