From dcb385da82a24af6a546d0dda9d2957d7384a65e Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Fri, 19 Jan 2024 13:38:18 +0100 Subject: [PATCH] Update nginx v0.7.2 --- conf/nginx.conf | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 4f85de8..69555ca 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,12 +1,26 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - proxy_pass http://127.0.0.1:__PORT__/; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_redirect off; } +# directly serve images and static files from the +# bookwyrm filesystem using sendfile. +# make the logs quieter by not reporting these requests +location ~ \.(bmp|ico|jpg|jpeg|png|tif|tiff|webp|css|js)$ { + root __INSTALL_DIR__; + try_files $uri =404; + add_header X-Cache-Status STATIC; + access_log off; +} + +# block access to any non-image files from images or static +location ~ ^/images/ { + return 403; +} + location /images/ { alias __INSTALL_DIR__/images/; }