Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion defaults/webserver/_bpp-locations.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ include /etc/nginx/conf.d/security-headers.conf;
# ERROR PAGES CONFIGURATION
# ============================================================================
# Custom error pages for better user experience
error_page 500 /static/500.html;
#
# error_page 500 jest definiowany PER-HOST w vhost.conf.template (potrzebuje
# ${VHOST_NAME}, którego envsubst NIE podstawia w tym pliku — jest on
# includowany dosłownie). Multi-hosted: każda domena dostaje własną stronę
# 500 z brandingiem swojej uczelni, z fallbackiem na generyczny /static/500.html.
error_page 502 503 504 /maintenance.html;
location = /maintenance.html {
root /usr/share/nginx/html;
Expand Down
16 changes: 16 additions & 0 deletions defaults/webserver/vhost.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,21 @@ server {
access_log /dev/stdout bpp_access;
access_log /var/log/nginx-shared/bpp_access.log bpp_access;

# Strona błędu 500 PER-DOMENA (multi-hosted). nginx próbuje najpierw
# /staticroot/500/<host>.html (branding uczelni przypisanej do tej domeny),
# a gdy go brak — generyczny /staticroot/500.html (fallback; dokładnie to,
# co generują obrazy pre-multi-hosted). Oba pliki produkuje w runtime
# `manage.py generate_500_page` (appserver) w $STATIC_ROOT = wolumen
# staticroot, widziany przez nginx pod /var/www/html/staticroot/.
# ${VHOST_NAME} podstawia envsubst przy renderze vhost-<host>.conf; ścieżki
# try_files są literalne (brak zmiennych runtime nginx-a). Ostatni argument
# =500 to twardy fallback, gdyby nawet generyczna strona nie istniała.
error_page 500 /__bpp_500__;
location = /__bpp_500__ {
internal;
root /var/www/html;
try_files /staticroot/500/${VHOST_NAME}.html /staticroot/500.html =500;
}

include /etc/nginx/bpp-templates/_bpp-locations.conf;
}