Skip to content

Commit 40e3fa2

Browse files
authored
Merge pull request #15144 from nextcloud/backport/15102/stable34
[stable34] docs: block access to metadata files in nginx sample configs
2 parents fb8c14f + bc41c34 commit 40e3fa2

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

admin_manual/installation/nginx-root.conf.sample

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Nextcloud nginx configuration — root installation
2-
# Version 2026-03-26
2+
# Version 2026-06-09
33

44
# PHP-FPM backend.
55
upstream php-handler {
@@ -151,6 +151,10 @@ server {
151151
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
152152
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
153153

154+
# Hide metadata files which would otherwise be served as plain files and
155+
# leak dependency information (composer.json, package.json, core/shipped.json).
156+
location ~ ^/(?:composer\.(?:json|lock)|package(?:-lock)?\.json|core/shipped\.json)$ { return 404; }
157+
154158
# Pass PHP requests to PHP-FPM.
155159
#
156160
# Important: this block must appear above the static asset locations

admin_manual/installation/nginx-subdir.conf.sample

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Nextcloud nginx configuration — subdirectory installation (/nextcloud)
2-
# Version 2026-03-26
2+
# Version 2026-06-09
33

44
# PHP-FPM backend.
55
upstream php-handler {
@@ -151,6 +151,10 @@ server {
151151
location ~ ^/nextcloud/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
152152
location ~ ^/nextcloud/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
153153

154+
# Hide metadata files which would otherwise be served as plain files and
155+
# leak dependency information (composer.json, package.json, core/shipped.json).
156+
location ~ ^/nextcloud/(?:composer\.(?:json|lock)|package(?:-lock)?\.json|core/shipped\.json)$ { return 404; }
157+
154158
# Pass PHP requests to PHP-FPM.
155159
#
156160
# Important: this block must appear above the static asset locations

0 commit comments

Comments
 (0)