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
1 change: 1 addition & 0 deletions nginx-proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LABEL org.label-schema.name="nginx-proxy"
COPY nginx.tmpl /app/
COPY nginx.conf /etc/nginx/nginx.conf
COPY version.conf /version.conf
COPY default.html /etc/nginx/html/default.html

RUN apt-get update \
&& apt-get install --no-install-recommends apache2-utils -y && rm -rf /var/lib/apt/lists/*
Expand Down
15 changes: 15 additions & 0 deletions nginx-proxy/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Site Not Configured</title>
<meta name="robots" content="noindex, nofollow, nosnippet, noarchive, noimageindex, notranslate">
<style>
body { font-family: Arial, sans-serif; background: #f8f8f8; color: #333; text-align: center; padding-top: 10vh; }
h1 { color: #c00; }
</style>
</head>
<body>
<h1>This domain is either disabled or not configured on this server.</h1>
<p>Please contact the administrator or check your domain settings.</p>
</body>
</html>
46 changes: 40 additions & 6 deletions nginx-proxy/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -184,23 +184,57 @@ server {
{{ $enable_ipv6 := eq (or ($.Env.ENABLE_IPV6) "") "true" }}
server {
server_name _; # This is just an invalid value which will never trigger on a real hostname.
listen 80;
listen 80 default_server;
{{ if $enable_ipv6 }}
listen [::]:80;
listen [::]:80 default_server;
{{ end }}
return 503;

root /etc/nginx/html;

# Custom error page for 503
error_page 503 /default.html;

location / {
return 503;
}

# Serve the error page without redirect
location = /default.html {
root /etc/nginx/html;
internal;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
}
}

{{ if (and (exists "/etc/nginx/certs/default.crt") (exists "/etc/nginx/certs/default.key")) }}
server {
server_name _; # This is just an invalid value which will never trigger on a real hostname.
listen 443 ssl;
listen 443 ssl default_server;
http2 on;
{{ if $enable_ipv6 }}
listen [::]:443 ssl;
listen [::]:443 ssl default_server;
http2 on;
{{ end }}
return 503;

root /etc/nginx/html;

# Custom error page for 503
error_page 503 /default.html;

location / {
return 503;
}

# Serve the error page without redirect
location = /default.html {
root /etc/nginx/html;
internal;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
}

ssl_session_tickets off;
ssl_certificate /etc/nginx/certs/default.crt;
Expand Down
Loading