Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: nginx: cache responses from app/download.php results #44

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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