From 168b0fa9b791d74a9f8625ea8983292624c4eec2 Mon Sep 17 00:00:00 2001 From: Brice Waegeneire Date: Thu, 20 Jan 2022 10:43:24 +0100 Subject: [PATCH] nginx: Add snippet for custom server block config. --- nginx/files/nginx/snippets/evolinux_server_custom | 7 +++++++ nginx/templates/evolinux-default.conf.j2 | 2 ++ 2 files changed, 9 insertions(+) create mode 100644 nginx/files/nginx/snippets/evolinux_server_custom diff --git a/nginx/files/nginx/snippets/evolinux_server_custom b/nginx/files/nginx/snippets/evolinux_server_custom new file mode 100644 index 00000000..f7f34ef9 --- /dev/null +++ b/nginx/files/nginx/snippets/evolinux_server_custom @@ -0,0 +1,7 @@ +# Evolinux custom configuration, to be used in all server blocks + +location ~ /\.(inc|git|bak|env) { + # We don't want to let the client know a file exist on the server, + # so we return 404 "Not found" instead of 403 "Forbidden". + return 404; +} diff --git a/nginx/templates/evolinux-default.conf.j2 b/nginx/templates/evolinux-default.conf.j2 index 1a385e17..a0ed95c3 100644 --- a/nginx/templates/evolinux-default.conf.j2 +++ b/nginx/templates/evolinux-default.conf.j2 @@ -49,6 +49,8 @@ server { stub_status on; access_log off; } + + include /etc/nginx/snippets/evolinux_server_custom; } server {