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.
51 lines
1.1 KiB
Nginx Configuration File
51 lines
1.1 KiB
Nginx Configuration File
server {
|
|
listen 8080;
|
|
listen [::]:8080;
|
|
|
|
root /var/www/html/public;
|
|
|
|
index index.php index.html index.htm;
|
|
|
|
client_max_body_size 512M;
|
|
client_body_timeout 300s;
|
|
|
|
location ~ \.php$ {
|
|
fastcgi_buffers 64 4K;
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
|
|
#try_files $uri =404;
|
|
try_files $fastcgi_script_name =404;
|
|
|
|
include fastcgi_params;
|
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
set $path_info $fastcgi_path_info;
|
|
fastcgi_param PATH_INFO $path_info;
|
|
include fastcgi_params;
|
|
|
|
fastcgi_index index.php;
|
|
fastcgi_pass legacy:9000;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.php$is_args$args;
|
|
}
|
|
|
|
location ~ ^/api/(v2|browser) {
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_redirect off;
|
|
proxy_pass http://api:9001;
|
|
}
|
|
|
|
# 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;
|
|
}
|
|
}
|