Use NGINX X-Accel-Redirect to protect media

This commit is contained in:
Alexandre Iooss 2021-10-21 21:06:51 +02:00
parent 29e9dba141
commit eb03db2dff
3 changed files with 22 additions and 4 deletions

View file

@ -34,8 +34,14 @@ server {
error_log /var/log/nginx/photos.crans.org_error.log;
access_log /var/log/nginx/photos.crans.org_access.log;
# Allow 2Go upload at once
client_max_body_size 2G;
# Django statics and media
location /media {
# Do not directly serve media, it must be authorized
# by a Django view to check permissions
location /protected/media {
internal;
alias /var/www/photos/photo21/media;
}
location /static {