proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection \$${var}_connection_upgrade;
-# the courtesy page when the daemon is down
-error_page 502 503 504 ${pfx}/error.php;
+# the courtesy page when the daemon cannot be reached: static, served from
+# this machine, because error.php needs php-fpm and the database, which may
+# be down together with the daemon
+error_page 502 503 504 ${pfx}/daemon-down.html;
EOF
ngx_put "$tmp" "$inc_f"
-o -name '*.js' -o -name 'LICENSE' -o -name 'VENDOR.txt'
-o -name 'terms-of-service*' )
if [ "$install_mode" != "server" ]; then
- find_names+=( -o -name '*.css' -o -name '*.mp3' -o -name '*.swf' )
+ find_names+=( -o -name '*.css' -o -name '*.mp3' -o -name '*.swf'
+ -o -name 'daemon-down.html' )
fi
for i in $(find web "${find_names[@]}" | sed 's/^....//g'); do
install -m 644 "web/$i" "${web_path}__/$i"
sed -i "s@var \+cookiepath \+= \+\"[^\"]*\";@var cookiepath = \"$prefix_path\";@g" ${web_path}__/commons.js
+# the courtesy page of nginx reaches its images and the room through <base>
+if [ -f "${web_path}__/daemon-down.html" ]; then
+ sed -i "s@<base href=\"[^\"]*\">@<base href=\"$prefix_path\">@" "${web_path}__/daemon-down.html"
+fi
+
sed -i "s@\( \+cookiepath *: *\)\"[^\"]*\" *,@\1 \"$prefix_path\",@g" ${web_path}__/xynt-streaming.js
# The root of the site is needed for two things: substituting
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
+
+# the courtesy page when the daemon cannot be reached: static, because
+# error.php needs php-fpm and the database, which may be down as well
+error_page 502 503 504 /brisk/daemon-down.html;
location / { try_files $uri $uri/ =404; }
- # error.php is the daemon courtesy page (it was ErrorDocument 500 in the
- # apache configuration)
+ # error.php was the daemon courtesy page (ErrorDocument 500 in the apache
+ # configuration). The daemon urls now answer with the static
+ # daemon-down.html (see brisk-daemon.inc); this covers the rest.
error_page 500 502 503 504 /error.php;
}
--- /dev/null
+<!DOCTYPE html>
+<!--
+ brisk - daemon-down.html
+
+ The courtesy page nginx answers with when the brisk-spush daemon cannot be
+ reached (error_page 502 503 504 in the configuration of the daemon urls).
+ It is static on purpose: error.php needs php-fpm and the database, and
+ when the front sends its php pages to the daemon machine those are down
+ together with the daemon.
+
+ nginx serves it with an internal redirect, so the browser still shows the
+ url it asked for, which may be <prefix>briskin5/index.php: every path
+ below goes through <base>, rewritten by INSTALL.sh with the prefix (-P).
+-->
+<html>
+<head>
+<meta charset="utf-8">
+<base href="/brisk/">
+<title>Brisk: errore!</title>
+<!-- fallback for browsers without javascript -->
+<noscript><meta http-equiv="refresh" content="20;url=./"></noscript>
+<link rel="shortcut icon" href="img/brisk_ico.png">
+<style>
+body {
+ margin: 0;
+ font-family: sans-serif;
+ background-image: url('img/saddysunbg.png');
+ text-align: center;
+}
+.headline { padding-top: 16px; font-size: 16px; }
+.content { padding: 160px 16px 0 16px; font-size: 18px; line-height: 1.5; }
+.en { font-size: 15px; color: #404040; }
+</style>
+</head>
+<body>
+<div class="headline">
+ <img src="img/brisk_logo64.png" alt="brisk"><br>
+ briscola chiamata in salsa ajax
+</div>
+<div class="content">
+ C'è qualche problema sul server.<br><br>
+ Tra qualche istante questa pagina proverà a riconnettersi automaticamente.<br><br>
+ Ci dispiace del disagio.<br><br>
+ <span class="en">There is a problem on the server: this page will reconnect by itself in a few moments.</span>
+</div>
+<script>
+// between 15 and 25 seconds, as error.php does: when the daemon comes back
+// the players do not all knock in the same instant
+setTimeout(function () { window.location.href = document.baseURI; },
+ (15 + Math.floor(Math.random() * 11)) * 1000);
+</script>
+</body>
+</html>