Skip to content

Commit 8ef2be7

Browse files
committed
Merge branch 'hypernext' of github.com:elabftw/elabimg into hypernext
* 'hypernext' of github.com:elabftw/elabimg: feat: nginx: cache responses from app/download.php results (#44)
2 parents b439c17 + d0baadf commit 8ef2be7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/nginx/common.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ location = /nginx-status {
7878
# deny access to hidden files/folders
7979
location ~ /\. { access_log off; log_not_found off; deny all; }
8080

81+
# for user uploaded files, use a long cache value, as uploads are not modified anyway: an URL points always to the same exact file
82+
location ^~ /app/download.php {
83+
more_set_headers "Cache-Control: public, max-age=31536000";
84+
include /etc/nginx/fastcgi.conf;
85+
fastcgi_index index.php;
86+
log_not_found off;
87+
88+
if (-f $request_filename) {
89+
fastcgi_pass unix:/run/php-fpm.sock;
90+
}
91+
}
92+
8193
# assets configuration
8294
location ~* \.(js|css|png|jpg|jpeg|gif|ico|map|ttf|txt|woff|woff2|svg|webmanifest)$ {
8395
access_log off;

0 commit comments

Comments
 (0)