REFACTOR: Updated the NGINX routes and combined some

This commit is contained in:
2025-03-02 16:00:14 +00:00
parent a5d27f9497
commit c7ad136f77

View File

@@ -48,7 +48,7 @@ http {
location /api/ {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://web_server:5000; # flask-app is the name of the Flask container in docker-compose
proxy_pass http://web_server:5000; # web_server is the name of the Flask container in docker-compose
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -77,40 +77,26 @@ http {
proxy_set_header Host $host;
}
# The MPEG-TS video chunks are stored in /tmp/hls
location ~ ^/stream/(.+)/(.+\.ts)$ {
## The HLS stream location with thumbnails
## Contains TS files, M3U8 files and PNG thumbnails
location ~ ^/stream/(.+)/(.+\.(ts|m3u8|png))$ {
alias /stream_data/stream/$1/$2;
# Let the MPEG-TS video chunks be cacheable
expires max;
}
# The M3U8 playlists location
location ~ ^/stream/(.+)/(.+\.m3u8)$ {
alias /stream_data/stream/$1/$2;
# The M3U8 playlists should not be cacheable
expires -1d;
}
## The thumbnails location
location ~ ^/stream/(.+)/thumbnails/(.+\.png)$ {
alias /stream_data/stream/$1/$2;
## VoDs Location and thumbnails
## Contains MP4 files and PNG thumbnails
location ~ ^/vods/(.+)/(.+\.(mp4|png))$ {
alias /stream_data/vods/$1/$2;
# The thumbnails should not be cacheable
expires -1d;
}
## The vods location
location ~ ^/stream/(.+)/vods/(.+\.mp4)$ {
alias /stream_data/vods/$1/$2;
# The vods should not be cacheable
expires -1d;
}
## Profile pictures location
location ~ ^/user/(.+)/profile_picture$ {
location ~ ^/user/(.+)/index.png$ {
alias /stream_data/profile_pictures/$1.png;
# The profile pictures should not be cacheable