1

I made a website using React and connected to Strapi. But I need to keep some background videos mainly on the home page. The main banner has 4 videos and the background of the page is also a video. The site was very heavy and overloaded, but the customer wants to continue with the background videos in infinite loop and autoplay. Is there any way to configure nginx to compress or add to cache, or optimize the loading of videos?

1
  • 2
    Why would you care? I mean, why do you not offload assets to a CDN so they do not come from YOUR server (or put something like cloudflare in front)? Also, why use a web server. And what compression do you expect - unless you bonkert is brutally, videos are already compressed with video compression. Nothing to not a lot would be gained from standard compression.
    – TomTom
    Feb 14 at 15:24

2 Answers 2

0

Once the video's downloaded the browser should just repeat playing it from its cache - you have a few options;

Make the video smaller - either by making its dimensions smaller, compress it more or use a better codec.

Increase the performance of the server - more/bigger-CPUs, more memory if you're low on that (as it'll use the memory to cache the videos).

Add more servers (behind a LB of course).

Use a caching service like akamai etc. to host the videos.

1
  • 1
    last point: run all traffic through cloudflare that should do that auomtically without hosting on a separate caching service.
    – TomTom
    Feb 14 at 15:24
0

You should pay attention to compression of the video files before they get given to nginx to serve, but nginx can't compress those better than your video software.

Delivering your media files via caches close to users might help (cloudflare and akamai have been suggested by others here, andthey are the big players).

Pay attention to caching flags on your media files. That will help browsers pages with the videos are loaded more than nce by the same browser, and will also help any intermediary caches to not have to check again with the origin server before serving the file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .