Skip to content

Commit

Permalink
Merge branch 'hypernext' of github.com:elabftw/elabimg into hypernext
Browse files Browse the repository at this point in the history
* 'hypernext' of github.com:elabftw/elabimg:
  feat: nginx: cache responses from app/download.php results (#44)
  • Loading branch information
NicolasCARPi committed Nov 25, 2024
2 parents b439c17 + d0baadf commit 8ef2be7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/nginx/common.conf
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ location = /nginx-status {
# deny access to hidden files/folders
location ~ /\. { access_log off; log_not_found off; deny all; }

# for user uploaded files, use a long cache value, as uploads are not modified anyway: an URL points always to the same exact file
location ^~ /app/download.php {
more_set_headers "Cache-Control: public, max-age=31536000";
include /etc/nginx/fastcgi.conf;
fastcgi_index index.php;
log_not_found off;

if (-f $request_filename) {
fastcgi_pass unix:/run/php-fpm.sock;
}
}

# assets configuration
location ~* \.(js|css|png|jpg|jpeg|gif|ico|map|ttf|txt|woff|woff2|svg|webmanifest)$ {
access_log off;
Expand Down

0 comments on commit 8ef2be7

Please sign in to comment.