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/ { location /api/ {
rewrite ^/api/(.*)$ /$1 break; 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_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
@@ -77,40 +77,26 @@ http {
proxy_set_header Host $host; proxy_set_header Host $host;
} }
# The MPEG-TS video chunks are stored in /tmp/hls ## The HLS stream location with thumbnails
location ~ ^/stream/(.+)/(.+\.ts)$ { ## Contains TS files, M3U8 files and PNG thumbnails
location ~ ^/stream/(.+)/(.+\.(ts|m3u8|png))$ {
alias /stream_data/stream/$1/$2; alias /stream_data/stream/$1/$2;
# Let the MPEG-TS video chunks be cacheable # Let the MPEG-TS video chunks be cacheable
expires max; expires max;
} }
# The M3U8 playlists location ## VoDs Location and thumbnails
location ~ ^/stream/(.+)/(.+\.m3u8)$ { ## Contains MP4 files and PNG thumbnails
alias /stream_data/stream/$1/$2; location ~ ^/vods/(.+)/(.+\.(mp4|png))$ {
alias /stream_data/vods/$1/$2;
# The M3U8 playlists should not be cacheable
expires -1d;
}
## The thumbnails location
location ~ ^/stream/(.+)/thumbnails/(.+\.png)$ {
alias /stream_data/stream/$1/$2;
# The thumbnails should not be cacheable # The thumbnails should not be cacheable
expires -1d; 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 ## Profile pictures location
location ~ ^/user/(.+)/profile_picture$ { location ~ ^/user/(.+)/index.png$ {
alias /stream_data/profile_pictures/$1.png; alias /stream_data/profile_pictures/$1.png;
# The profile pictures should not be cacheable # The profile pictures should not be cacheable