nginx: Disable .git dir
All checks were successful
Build Docker / CheckFiles (push) Successful in 5s
Build Docker / Build Docker (push) Successful in 27s

This commit is contained in:
Nathan Woodburn 2023-09-30 12:36:11 +10:00
parent 54db77af8f
commit f368bf2de5
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,4 @@
FROM nginx:alpine
COPY . /usr/share/nginx/html
COPY ./assets/img/favicon.png /usr/share/nginx/html
COPY ./assets/img/favicon.png /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

24
nginx.conf Normal file
View File

@ -0,0 +1,24 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri.html $uri/ =404;
}
location ~ /\.git {
deny all;
access_log off;
log_not_found off;
}
# Custom 404 page
error_page 404 /404.html;
location = /404.html {
}
}