feat!: use nginx to serve media files (#2860)

Closes #2522

To reduce the strain on the API service, we moved the media file serving
to the Nginx web server. The API is still handling the authentication,
but delegates the serving using the `X-Accel-Redirect` header.

BREAKING CHANGE: The media file serving is now handled by Nginx instead
of the API service. The `storage.path` field is now used in the Nginx
configuration, so make sure to update the Nginx configuration file if
you change it.
This commit is contained in:
Jonas L 2023-12-30 18:59:15 +01:00 committed by GitHub
parent 8406d520d7
commit 4603c1759f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 53 additions and 10 deletions

View file

@ -72,11 +72,32 @@ The `storage` section configure the project storage.
```yml
storage:
# Path of the storage directory.
# Path of the storage directory. Make sure to update the Nginx configuration after
# updating the storage path.
# > default is /srv/libretime
path: "/srv/libretime"
```
:::caution
After editing the `storage.path` field, make sure to update the LibreTime Nginx configuration file with the new value.
In the example below, we are changing the path from `/srv/libretime` to `/mnt/data`:
```patch
...
# Internal path for serving media files from the API.
location /api/_media {
internal;
# This alias path must match the 'storage.path' configuration field.
- alias /srv/libretime;
+ alias /mnt/data;
}
```
:::
## Database
The `database` section configure the PostgreSQL connection.