Skip to content

Commit f6ce783

Browse files
committed
Merge branch 'develop' for v4.9.1
2 parents 9c7d53c + fdd366a commit f6ce783

3 files changed

Lines changed: 56 additions & 6 deletions

File tree

nginx-proxy/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LABEL org.label-schema.name="nginx-proxy"
66
COPY nginx.tmpl /app/
77
COPY nginx.conf /etc/nginx/nginx.conf
88
COPY version.conf /version.conf
9+
COPY default.html /etc/nginx/html/default.html
910

1011
RUN apt-get update \
1112
&& apt-get install --no-install-recommends apache2-utils -y && rm -rf /var/lib/apt/lists/*

nginx-proxy/default.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Site Not Configured</title>
5+
<meta name="robots" content="noindex, nofollow, nosnippet, noarchive, noimageindex, notranslate">
6+
<style>
7+
body { font-family: Arial, sans-serif; background: #f8f8f8; color: #333; text-align: center; padding-top: 10vh; }
8+
h1 { color: #c00; }
9+
</style>
10+
</head>
11+
<body>
12+
<h1>This domain is either disabled or not configured on this server.</h1>
13+
<p>Please contact the administrator or check your domain settings.</p>
14+
</body>
15+
</html>

nginx-proxy/nginx.tmpl

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,23 +184,57 @@ server {
184184
{{ $enable_ipv6 := eq (or ($.Env.ENABLE_IPV6) "") "true" }}
185185
server {
186186
server_name _; # This is just an invalid value which will never trigger on a real hostname.
187-
listen 80;
187+
listen 80 default_server;
188188
{{ if $enable_ipv6 }}
189-
listen [::]:80;
189+
listen [::]:80 default_server;
190190
{{ end }}
191-
return 503;
191+
192+
root /etc/nginx/html;
193+
194+
# Custom error page for 503
195+
error_page 503 /default.html;
196+
197+
location / {
198+
return 503;
199+
}
200+
201+
# Serve the error page without redirect
202+
location = /default.html {
203+
root /etc/nginx/html;
204+
internal;
205+
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
206+
add_header Pragma "no-cache" always;
207+
add_header Expires "0" always;
208+
}
192209
}
193210

194211
{{ if (and (exists "/etc/nginx/certs/default.crt") (exists "/etc/nginx/certs/default.key")) }}
195212
server {
196213
server_name _; # This is just an invalid value which will never trigger on a real hostname.
197-
listen 443 ssl;
214+
listen 443 ssl default_server;
198215
http2 on;
199216
{{ if $enable_ipv6 }}
200-
listen [::]:443 ssl;
217+
listen [::]:443 ssl default_server;
201218
http2 on;
202219
{{ end }}
203-
return 503;
220+
221+
root /etc/nginx/html;
222+
223+
# Custom error page for 503
224+
error_page 503 /default.html;
225+
226+
location / {
227+
return 503;
228+
}
229+
230+
# Serve the error page without redirect
231+
location = /default.html {
232+
root /etc/nginx/html;
233+
internal;
234+
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
235+
add_header Pragma "no-cache" always;
236+
add_header Expires "0" always;
237+
}
204238

205239
ssl_session_tickets off;
206240
ssl_certificate /etc/nginx/certs/default.crt;

0 commit comments

Comments
 (0)