From 10c27ca51b37070d648af55aea1083125d23bb56 Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot <code.commits@artfulrobot.uk> Date: Mon, 13 Jan 2025 23:17:17 +0000 Subject: [PATCH 1/2] Allow access to json files in public, core, ext (required by mosaico). Also allow .webp files --- nginx-site.conf.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx-site.conf.example b/nginx-site.conf.example index 761075d..968440f 100644 --- a/nginx-site.conf.example +++ b/nginx-site.conf.example @@ -157,7 +157,7 @@ server { # then create a separate rule that covers strictly what you expect and nothing wider. # You want to ensure that any files a developer might accidentally create/leave around # like backups, sql dumps etc. are not world-accessible. - location ~ ^/(public|core|ext)/.*\.(png|css|jpg|js|mjs|gif|ico|svg|woff2|html)$ { + location ~ ^/(public|core|ext)/.*\.(png|css|jpg|js|mjs|json|webp|gif|ico|svg|woff2|html)$ { # Return the file if it exists, or a 404 try_files $uri 404; } From 6522b9b4f8807d0480c08e3bf3fdfb2ad4e2431b Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot <code.commits@artfulrobot.uk> Date: Mon, 13 Jan 2025 23:21:34 +0000 Subject: [PATCH 2/2] nginx: Add note re aliasing old image files to new --- nginx-site.conf.example | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nginx-site.conf.example b/nginx-site.conf.example index 968440f..905a566 100644 --- a/nginx-site.conf.example +++ b/nginx-site.conf.example @@ -169,6 +169,14 @@ server { fastcgi_pass php-fpm; } + + # @todo If you have migrated from Drupal7 and moved your images + # to the new location, you can use something like this which will + # allow requests to the old paths to serve the images from their new paths. + # location /sites/default/files/civicrm/persist/contribute/images/ { + # alias /var/www/example.org/docroot/public/media/images/; + # } + # Default location. location / { return 404;