Skip to content

Commit

Permalink
blocks certain paths in Nginx config
Browse files Browse the repository at this point in the history
  • Loading branch information
Tawmu committed Mar 5, 2024
1 parent 4def633 commit 1bb8cab
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions openresty/rootfs/usr/local/openresty/nginx/conf/site.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,28 @@ server {
root /usr/local/openresty/nginx/html;
internal;
}

# Block access to dot files except the .well-known directory
location ~* /\.(?!well-known\/) {
deny all;
return 404;
}

# Unlikely to have these but block access to certain filetypes
location ~* (?:\.(?:bak|conf|yaml|yml|cfg|fla|in[ci]|log|psd|sh|sql)|~)$ {
deny all;
return 404;
}

# Block access to composer files
location ~* composer\.(?:json|lock) {
deny all;
return 404;
}

# Block certain directories
location ~ /(vendor|behat|node_modules) {
deny all;
return 404;
}
}

0 comments on commit 1bb8cab

Please sign in to comment.