add custom 404 page

This commit is contained in:
Lee 2024-01-11 05:44:41 +00:00
parent c2219d60b9
commit 9d7ccbda40
4 changed files with 92 additions and 0 deletions

@ -24,6 +24,9 @@ COPY ./docker/nginx.conf /etc/nginx/nginx.conf
COPY ./upload.php /tmp/upload.php
COPY ./docker/start.sh /start.sh
# Copy public directory
COPY ./public /tmp/public
# Stage 2: Create a smaller production image
FROM alpine:3.18.4
@ -33,6 +36,7 @@ COPY --from=builder /usr/local/sbin/nginx /usr/local/sbin/nginx
COPY --from=builder /etc/nginx /etc/nginx
COPY --from=builder /tmp/upload.php /tmp/upload.php
COPY --from=builder /start.sh /start.sh
COPY --from=builder /tmp/public /tmp/public
# Install runtime dependencies
RUN apk update && apk upgrade && \

@ -63,5 +63,11 @@ http {
# Serve the file directly from disk
try_files $uri $uri/ =404;
}
# Fallback 404 page
location = /404.html {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
}
}

63
public/assets/tailwind.js Normal file

File diff suppressed because one or more lines are too long

19
public/not-found.html Normal file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>File Not Found</title>
<!-- TailwindCSS -->
<script src="./assets/tailwind.js"></script>
</head>
<body
class="h-screen bg-neutral-900 text-white flex flex-col text-center justify-center items-center p-4 gap-2"
>
<p class="text-red-400 text-3xl">404 - File Not Found</p>
<p class="text-gray-400 text-xl">
We're sorry, the file you requested could not be found.
</p>
</body>
</html>